有什么方法可以让一个类的typedef朋友吗?

问题描述 投票:0回答:1

...就我而言:

    template<class X>
    struct _Command {
        char*   id;
        char*   description;
        char    messages[10][100];
        bool    (X::*function)();
    };

    Class Server {
        public:
            typedef _Command<Server>Command;
    }

如何使Command成为Server类的朋友?

c++ typedef
1个回答
0
投票

您可以在朋友声明中正常使用typedef(自C ++ 11起:Documentation

© www.soinside.com 2019 - 2024. All rights reserved.