+1

Why does an abstract class can have a constructor

As we know that, we can't create the object for an abstract class and also we know that a constructor initialized the value of class automatically

8/14/2019 4:43:16 AM

Shivam chanchal

3 Answers

New Answer

+5

Not everything in an abstract class is totally abstract.

+2

Abstract class provide us with features and let us specialise aspects it by inheritance. Those features of an abstract class might require some data, of course. It there wasn't a constructor then user of an abstract class would be obligated to define that data in constructor of a derived class. It's not convenient at all :) So we use constructor of a base class for that reason.

0

Totally abstract class is called an interface.