Abstract class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Abstract class

why do we said that To use an abstract class, you have to inherit it from another class?

21st Oct 2020, 7:34 PM
Mennatullah Mohamed Abdelmaqsoud
Mennatullah Mohamed Abdelmaqsoud - avatar
3 Answers
+ 2
Because abstract have atleast one abstract method and which shloud be provided a concrete (implementation) to use that and to create an object. For that we need to inherit to another class which shloud provide abstract method defination. Until that we cannot create an object for abstract class, so without an object, we cannot use that class properties.
21st Oct 2020, 7:48 PM
Jayakrishna 🇮🇳
+ 2
Exactly, an abstract class is a restricted class from which no objects can be created and can only be accessed through inheritance.
21st Oct 2020, 7:47 PM
Mariano Fregosi
Mariano Fregosi - avatar
+ 2
I understood from the second slide of abstract classes thanks a lot
21st Oct 2020, 7:51 PM
Mennatullah Mohamed Abdelmaqsoud
Mennatullah Mohamed Abdelmaqsoud - avatar