关于符号 :: 的问题
#include <iostream>
using namespace std;
///////////////////////////////////////////////////////////////////////////////
class A
{
public:
void f(int i)
{
cout<<i<<endl;
}
void g()
{
cout<<"A\n";
}
};
class B: A
{
public:
void h()
{
cout<<"B\n";
A::f;
}
};
int main()
{
B b;
b.f(10);
// b.g();
b.h();
return 0;
}
错误提示
24 D:\PERSONAL\aaa\singleinherit.cpp
statement cannot resolve address of
D:\PERSONAL\aaa\singleinherit.cpp
[Warning] In function `int main()':
9 D:\PERSONAL\aaa\singleinherit.cpp
`void A::f(int)' is inaccessible
31 D:\PERSONAL\aaa\singleinherit.cpp
within this context