An abstract class is a base class from which other classes can be derived. An abstract class serves as a foundational blueprint for creating more concrete classes.
Abstract classes cannot be instantiated directly.
They can implement methods of their own.
They can define methods that inheriting classes must implement.
They are primarily used for inheritance, allowing other classes to extend from them.
Abstract methods or properties: Abstract classes typically include one or more abstract methods or property declarations.
Inheritance: Other classes derive from abstract classes to share common functionality.
No direct instantiation: You cannot create an instance of an abstract class directly.
A property name.
A normal method display().
An abstract method find(name: string): Person.
Employee derives from Person.
Employee must implement the find() method defined in Person.
The abstract class enforces a contract that derived classes must fulfill.
When implementing an abstract class, the derived class must call super() in its constructor.
Abstract classes can also include abstract properties.
Remember, abstract classes provide a powerful way to structure and share functionality while ensuring adherence to a specific contract.