In the following code, g++ gives this error :
1.cpp: In member function void W::test()':
1.cpp:6: error:
int F::glob' is private
1.cpp:19: error: within this context
But, shouldn't the globally declared variable 'glob' be used here, instead of the "private" "glob"?
#include <iostream.h>
int glob;
class F
{
int glob;
public:
void readIt()
{
cin >> glob;
}
};
class W : public F
{
public:
void test()
{
glob--;
}
};
int main()
{
}