🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

1 total messages Started by frodo@ncr-fc.FtC Sat, 04 Mar 1989 17:08
Constructors for (non-public) derived classes
#2700
Author: frodo@ncr-fc.FtC
Date: Sat, 04 Mar 1989 17:08
40 lines
1196 bytes
I have a problem with calling a constructor for a derived class that is
not publicly derived from a base class.  These classes look something
like:


class B				| class D : B   // *NOT* public B
{				| {
 public:			|  public:
  B(various args);		|   D(various args);
  B(B& Ref);			|   D(D& Ref);
  void operator=(B& Ref);	|   void operator=(D& Ref);
  ~B();				|   ~D();
 protected:			|  protected:
 private:			|  private:
}				| }

Here are the constructors for them:

   B::B(various args) {}
   B::B(B& Ref) {}
   // ...

   D::D(various args) : (other various args) {}
   D::D(D& Ref) : (Ref) {}			<== offending line


Now, using AT&T 1.2.1 I get an error from the compiler that looks like:

   "foo.cc", line 116: error: bad argument list for overloaded base::base()

However, if I publicly derive D (i.e., class D : public B {} ) then
everything is okey-dokey.  Why does it matter that the class is not
publicly derived?  I can't find anything in the C++ documentation/book
that says this is verbotten.  Thanks for the help.
--
David Fletcher, NCR Microelectronics
2001 Danfield Court,
Ft. Collins, CO 80525	  |	"... Let everything else go ..."
(303) 223-5100 x 241	  |			-- Phil Keaggy
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads