Reputation: 43199
I know how to do this in C++:
class myClass : public baseClass1 private baseClass2 ...
How do I do likewise in C#?
This is what I have so far in C#
public class myClass : baseClass1, baseClass2
How do I specify that baseClass2 is private?
Upvotes: 1
Views: 208
Reputation: 3530
Use "has-a" (aggregation) instead of "is-a" (inheritance). Qualify calls to the desired class with the member name.
Upvotes: 0
Reputation: 46
When you have a class inheriting other classes you have no means of specifying access - shouldn't need to. The inherited members/properties/methods have the same access level as specified in the base class.
Upvotes: 0
Reputation: 191037
C# does not have multiple inheritance. What you could do is a composite with baseClass2
.
Upvotes: 5
Reputation: 109017
C# does not support multiple inheritance and it does not support private inheritance either.
Upvotes: 10