6
Reply

Between public and private inheritance.

siabanie banie

siabanie banie

Jan 23 2012 1:11 PM
1.7k

In c++: What is the difference between public and private inheritance?

As far as I know that public and private inheritance does not dictate what is inherited but how it is inherited? So if I have these choice would it be true if I say the correct answer is: d) but the answer for c) seem true too? 

(a) Publicly derived classes inherit only the public data members, whereas privately
derived classes inherit only the private data members
(b) Publicly derived classes inherit both the public and private data members, whereas
privately derived classes inherit only the private data members
(c) Public inheritance makes the public members of the base class public in the derived
class; private inheritance makes public base class members private in the derived
class
(d) Private inheritance changes the default accessibility for new members of a derived
class to private: whereas public inheritance leaves the default for new members as
public:
(e) Public inheritance represents an "is implemented as" relationship, whereas private
inheritance represents an "is a" relationship

Can anyone clarify me on these. Thanks.

Answers (6)
Next Recommended Forum