I am learning the programming language C#. Currently I am training programs in C # and lately came to a question, how to get multiple inheritance in a C#; any help would be highly appreciated.
I am learning the programming language C#. Currently I am training programs in C # and lately came to a question, how to get multiple inheritance in a C#; any help would be highly appreciated.
C# does not support the multiple inheritances directly. So, in order to get multiple inheritances you have to use interface. Interface is able to define methods, properties, indexers, and events, but they are not allowed to do any implementation.
E.g
using System;
interface IConstructionVehicle
{
void ExecuteDump();
void TurnOnBackUpSound();
}
interface IVehicle
{
void Accelerate();
void Stop();
void TurnOnBackUpSound();
}
Bookmarks