Learning about abstraction
Abstraction is one of the core principles of Object-Oriented Programming (OOP) and is used to hide object implementation details. It is important to understand abstraction to support correct implementation.
An example of abstraction is when we have an abstract User class and multiple subclasses that inherit from it. For example, we might have a Learning Management System (LMS) User class and three subclasses—Student, Teacher, and Administrator. We can implement a method overriding the inherited methods that would otherwise expose the implementation details. More specifically, the superclass defines the methods and the subclasses implement them.
As you can see in the following UML diagram, the Student, Teacher, and ...
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