Click here to Skip to main content
15,867,686 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
MSDN says, System.Object is the ultimate base class of all classes in the .NET Framework; it is the root of the type hierarchy.

When C# doesnt allow multiple inheritance, how can I inherit, say a Class A to Class B. ? Because all classes, already inherits from System.Object right? Here I am talking about the normal inheritance.

Class A { --- }
Class B : A { --- }
Please, clear the doubts...

All classes inheriting from System.Object, then that would make Class B having Class A as well as System.Object.
Posted
Updated 30-Oct-14 1:11am
v2

When you write:
C#
class B : A {/*...*/}

class B inherits from Object via class A, hence you have
Object <- A <- B
this is not multiple inheritance.
 
Share this answer
 
In very short:

Read Solution #1 from CPallini. He is explaining why the situation you described is not multiple inheritance.
To give you a basic idea what multiple inheritance is:
You have e.g. two classes
class A
class B
and from this you do (not possible in c#)
class AB: A, B
So class AB inherits from two independent classes.

Very short, but you will find a lot about this with Google.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900