Can an abstract class inherit another abstract class? | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
+ 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 Respostas
+ 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