2

One quick question.

I understand that multiple inheritance is not supported in c#.net. But you can still achieve the functionality by implementing multiple interfaces. Now my question is Can a child class inherit from two or more classes as long as they are abstract?

3 Answers3

8

In short, no. Multiple interface inheritance implementation is possible, but not multiple class inheritance (abstract or not).

Mat Nadrofsky
  • 8,289
  • 8
  • 49
  • 73
Jason Down
  • 21,731
  • 12
  • 83
  • 117
2

You can't inherit from multiple classes, period. No matter if abstract or not. Read about extension methods, that may help you a bit: if your classes implement an interface, you can attach common functionality to them without inheritance and copy-paste.

fejesjoco
  • 11,763
  • 3
  • 35
  • 65
2

No you can only inherit from one class whether it is abstract or concrete.

Here is link to a question that has quite a detailed discussion of abstract vs base classes

Interface vs Base class

Community
  • 1
  • 1
Greg
  • 1,984
  • 1
  • 10
  • 12