This is the mail archive of the gcc@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]

Inheritance Problem


Hello,

the follwoing code isn't working (with the gcc-2.95.2).
If I see the inharritance it should !

class A {
public:
  void ModifyAnother(A* a2) {
    b = 1;              // is working
    a2->b = 1;          // woking as well
  }
protected:
  int b;
};
 
 
class B : public A {
public:
  void ModifyAnother(A* a2)  {
    b = 1;              // is working
    a2->b = 1;          // not working
  }
};

int main() {
    B b;
}

`int A::b' is protected 

Well but, B is derived from A !!
What's going on here ?

Thanks
Olaf


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