Why can the abstract class not be instantiated?
Why can the abstract class not be instantiated?
521
27-Aug-2021
Aryan Kumar
24-Jun-2023An abstract class cannot be instantiated because it is not complete. An abstract class can have abstract methods, which are methods that do not have an implementation. This means that the abstract class does not know how to implement the abstract methods.
If an abstract class could be instantiated, then the abstract methods would be called, and the abstract class would not know how to respond. This would cause a runtime error.
Abstract classes are used to provide a common base class for other classes, or to define a set of methods that must be implemented by other classes. They are not intended to be used to create objects.
Here are some of the reasons why an abstract class cannot be instantiated:
In conclusion, an abstract class cannot be instantiated because it is not complete and it can be used to achieve polymorphism.