Does C# have the notion of private and protected inheritance?

C# allows public inheritance only. C++ allowed all three kinds. Public inheritance implied an “IS-A” type of relationship, and private inheritance implied a “Is-Implemented-In-Terms-Of” kind of relationship. Since layering (or composition) accomplished this in an arguably simpler fashion, private inheritance was only used when absolutely required by protected members or virtual functions required it – according to Scott Meyers in Effective C++, Item 42.

My guess would be that the authors of C# did not feel this additional method of implementing one class in terms of another was necessary.

Leave a Comment