Ans to this question is Yes . Abstract class can have constructors. Now the question is usage of it because we can't create object of Abstract Class. The abstract class constructor is called when in child class its methods are defined and they are called in another class. When we create an object of any subclass all the constructors in the corresponding inheritance tree are invoked in the top to bottom approach. The same case applies to abstract classes.
No comments:
Post a Comment