Bsp.: Private Vererbung

#include <iostream.h>

class A
{
  // wie vorher
};

class B : private A
{
  // wie vorher
};

main()
{
  A a;
  cout << a.a1 << a.a2 << a.a3 << endl;
}
//inh2b.cc: In method `B::B()':
//inh2b.cc:20: member `a3' is private
//inh2b.cc: In function `int main()':
//inh2b.cc:32: member `a2' is a protected member of class `A'
//inh2b.cc:32: member `a3' is a private member of class `A'

previous up next


© 1997 Gottfried Rudorfer, C++-AG, Lehrveranstaltungen, Abteilung für Angewandte Informatik, Wirtschaftsuniversität Wien, 12/16/1998