Abstract classes
You can compare the definition of an abstract class with an interface. It's a class with abstract methods and no functionality into the methods. The abstract class cannot be constructed (like any other class) and can only be used in a class that extends the abstract class.
The big difference with an interface is that you can add member variables and methods with logic in the class, and call the logic from the child class. Before going back to our movies, we will create an abstract class with the movie object and the child classes will earn the functionality from the main movie class.
This following code includes the abstract class, where we create a model for the movie (including the functionality). We define this class ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access