frodo@ncr-fc.FtCollins.NCR.COM (David Fletcher) (03/05/89)
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