what is the use of constructer in abstract class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

what is the use of constructer in abstract class

how do we use constructer in abstract class

2nd Aug 2016, 11:29 AM
K Sravan Kumar
K Sravan Kumar - avatar
3 Answers
+ 2
Abstract classes have constructors and those constructors are always invoked when a concrete subclass is instantiated. We know that when we are going to instantiate a class, we always use constructor of that class. Now every constructor invokes the constructor of its super class with an implicit call to super().
5th Aug 2016, 4:17 AM
Mohit Sharma
Mohit Sharma - avatar
+ 1
Another thing is also that abstract class may sometime contain fields...and thats where constructors do come handy while dealing with abstract classes
5th Aug 2016, 4:18 AM
Mohit Sharma
Mohit Sharma - avatar
0
abstract class they can not creat constructer because of they can not create object
12th Aug 2016, 12:19 PM
srilekha