Bsp.: Externer Zugriff auf abgeleitete Klasse (private)

#include <iostream.h>

class A
{
  // wie vorher
};

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


main()
{
  B b;
  cout << b.a1 << b.a2 << b.a3 << endl;
  cout << b.b1 << b.b2 << b.b3 << endl;
}

//inh3b.cc: In function `int main()':
//inh3b.cc:31: member `a1' is from private base class
//inh3b.cc:31: member `a2' is from private base class
//inh3b.cc:31: member `a3' is private
//inh3b.cc:32: member `b2' is a protected member of class `B'
//inh3b.cc:32: member `b3' is a private member of class `B'

previous up next


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