- This topic has 1 reply, 2 voices, and was last updated 18 years, 9 months ago by .
Viewing 1 reply thread
Viewing 1 reply thread
- The forum ‘C# Programming’ is closed to new topics and replies.
Home › Forums › C# Programming › Inheritance in C#
Does C# have the same inheritance procedure as java have? Or you can inherit multiple classes into your class. and what is the procedure to inherit a class in your own class?
C#.NET supports single inheritance of classes. One class can be derived from a single class.
1 2 3 | class MyFirstClass : MySecondClass {<br /> //functions and data members here<br /> } |
Here MyFirstClass inherits MyFirstClass and its properties and methods.
C#.NET does not support private and public inheritance just lik C++.
C# supports abstract classes and abstract functions like in java. You can not make the instance of an abstract class.
1 2 3 | abstract class Animal {<br /> public abstract void Eat(string food);<br /> } |