In the following code, g ++ gives this error: 1.cpp: In a member function, void W::test()':
1.cpp:6: error:
int F :: glob 'is private 1.cpp: 19: error: in this context
But one should not declare globally here the variable 'glob' "private" "glob" is used?
#include <iostream.h>
int glob;
class F
{
int glob;
public:
void readIt()
{
cin >> glob;
}
};
class W : public F
{
public:
void test()
{
glob--;
}
};
int main()
{
}
source
share