+ 5

Can an abstract class inherit another abstract class?

If yes then whats the purpose to do so.

20th Nov 2019, 8:55 AM
Nilesh Shelar
Nilesh Shelar - avatar
2 ответов
+ 8
Yes an abstract class can inherit from another abstract class. What if you want to add more behaviours of different type, other than your base class to your objects. Under such conditions you can use it.
20th Nov 2019, 8:58 AM
Avinesh
Avinesh - avatar
+ 1
abstract class Creature { void Exist(); } abstract class Animal : Creature { void Live(); } class Dog : Animal { public void Exist() { Console.WriteLine("dog exists") ; } public void Live() { Console.WriteLine("dog is alive") ; } } }
21st Nov 2019, 5:14 AM
Платонов Лев
Платонов Лев - avatar