0
为什么B :: Func调用A :: Func使用语法使它看起来像一个静态方法调用?不应该失败,因为它是一种实例方法?实例方法被称为静态方法
class A {
public:
void Func() {
printf("test");
}
};
class B : private A {
public:
void Func() {
A::Func(); // why does it work? (look below in main())
}
};
int main() {
B obj;
obj.Func();
// but we cannot write here, because it's not static
// A::Func();
return 0;
}