Home Forums C# Programming Inheritance in C# Reply To: Inheritance in C#


C#.NET supports single inheritance of classes. One class can be derived from a single class.

class MyFirstClass : MySecondClass {
   //functions and data members here

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.

abstract class Animal {
  public abstract void Eat(string food);