H
H. S.
I am getting this error if I try to compile the file demarcated below.
What I am missing here? I am using g++ (GCC) 3.3.5 (Debian 1:3.3.5-8).
{tp2}> g++ -ansi -g -Wall tp2.cc -o tp2
tp2.cc: In member function `void Other:oSomething()':
tp2.cc:11: error: `int Base::iX' is protected
tp2.cc:29: error: within this context
// %< %< ----------------------------------- %< %<
#include <cstdio>
#include <iostream>
class Base{
public:
Base();
protected:
int iX;
};
Base::Base():iX(7){}
class Derivedublic Base{};
class Other{
public:
Derived* D;
void DoSomething();
};
void Other:oSomething(){
std::cout << D->iX;
}
int main(){}
// %< %< ----------------------------------- %< %<
Thanks,
->HS
What I am missing here? I am using g++ (GCC) 3.3.5 (Debian 1:3.3.5-8).
{tp2}> g++ -ansi -g -Wall tp2.cc -o tp2
tp2.cc: In member function `void Other:oSomething()':
tp2.cc:11: error: `int Base::iX' is protected
tp2.cc:29: error: within this context
// %< %< ----------------------------------- %< %<
#include <cstdio>
#include <iostream>
class Base{
public:
Base();
protected:
int iX;
};
Base::Base():iX(7){}
class Derivedublic Base{};
class Other{
public:
Derived* D;
void DoSomething();
};
void Other:oSomething(){
std::cout << D->iX;
}
int main(){}
// %< %< ----------------------------------- %< %<
Thanks,
->HS