在类定义中使用 using 是什么意思?
class myClass {
public:
[...]
using anotherClass::method;
};
最佳答案
该声明取消隐藏 基类成员。这最常用于允许成员函数的重载。示例:
class Base {
public:
void method() const;
};
class Derived : public Base {
public:
void method(int n) const;
// Without the using, you would get compile errors on d.method();
using Base::method;
};
关于c++ - C++ using 在类中意味着什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5205105/