Junior OOP

What is the workaround for multiple inheritance in C#?

  • Use interfaces to achieve multiple inheritance.
  • A class can implement multiple interfaces.

interface IFlyable { void Fly(); }

interface IDriveable { void Drive(); }

class FlyingCar : IFlyable, IDriveable { public void Fly() {} public

void Drive() {} }

More from C# Programming Tutorial

All questions for this course