Abstract Class
Discover the use of abstract classes to define inheritable characteristics, behaviors, and implementations for subclasses.
Understanding abstract classes
Mammals are a group of animals, not a concrete species. The term defines a set of characteristics but might not exist in itself. To define a class that can only be used as a superclass of other classes but cannot produce an object, we use the abstract
keyword before its class definition.
Points to remember:
We can interpret the
open
modifier to mean that we can inherit from this class.Whereas
abstract
means that we must inherit from this class to use it.
Get hands-on with 1300+ tech skills courses.