Sample Question #192 (programming – C++)
What are some of the differences between private and protected inheritance in C++?
First, even though it’s probably obvious, you should mention that protected members use the keyword "protected."
The main difference is when you derive another class ("third-generation" class) from the current derived class, private inheritance prevents the third-gen class from using the internal structure of the base class. With protected inheritance, you don’t have this problem (or feature, depending on how you look at it).
Fill in your details below or click an icon to log in:
You are commenting using your WordPress.com account. ( Log Out / Change )
You are commenting using your Twitter account. ( Log Out / Change )
You are commenting using your Facebook account. ( Log Out / Change )
You are commenting using your Google+ account. ( Log Out / Change )
Connecting to %s
Notify me of new comments via email.
Notify me of new posts via email.