delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1992/08/28/15:03:23

From: greve AT rs1 DOT thch DOT uni-bonn DOT de (Thomas Greve)
Subject: weird C++ inheritance problem
To: djgpp AT sun DOT soe DOT clarkson DOT edu
Date: Fri, 28 Aug 92 20:06:52 NFT
Cc: comp DOT unix DOT aix AT cc DOT ysu DOT edu, aix-l AT pucc DOT bitnet

Hello all,

the following code is the essence of a problem, that took me half a
day to find out:

---------------------------------------------------------------------------
class A
{
  int B;
};

class B : A
{
  int b;
 public:
  B(int i = 0) { b = i; }
};

B *x = new B(1);
---------------------------------------------------------------------------

gcc said:
test.cc:13: member `B' is private

;-)
				- Thomas

PS: sorry for asking the n+1st time: where do i send wishes for
    clearer gcc error msg's?

   greve AT rs1 DOT thch DOT uni-bonn DOT de
   unt145 AT dbnrhrz1

- Raw text -


  webmaster     delorie software   privacy  
  Copyright 2019   by DJ Delorie     Updated Jul 2019