This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Protected member functions


I looked in my 1990 edition of the annotated C++ reference manual and
I can't find any reason why the call to head.getdata() illegal. I
believe it to be a bug. It seems like gcc 2.7.3 has the same
problem. Unfortunately I do not have a different c++ compiler to test
it against. Is there a something that I am missing or is this in fact
a bug?

class BerBase {
protected:
  char *getdata(); 
  int i;
};

class BerSequence: public BerBase{
public:
  BerSequence();
};

BerSequence::BerSequence(){
  BerBase head;
  head.getdata();
  i=1;
}

The error messages are:
test.C: In method `BerSequence::BerSequence()':
test.C:3: `char * BerBase::getdata()' is protected
test.C:14: within this context


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]