I am writing a small program in Visual C++ 2010.
This is code of the base class:
class BaseInfo {
private:
std::map <std::string, std::string> info;
std::vector<std::string> extra_info_key;
public:
uint get_id ();
//Other function is hidden
};
uint BaseInfo::get_id () {
return (uint)atoi ((info["ID"]).c_str());
}
Then I make a derived class, which is announced as:
class test:BaseInfo {
public:
void f();
};
void test::f (test& inf) {
cout<<inf.get_id()<<endl;
}
But I got an error:
function "BaseInfo::get_id is inaccessible.
I am confused, it seems all is in the c++ rules.