What are the pillars of Object-Oriented Programming?
The four pillars for Object-Oriented Programming(OOP) are Abstraction, Encapsulation, Polymorphism, Inheritance.
Data abstraction is the process of hiding certain details and showing only essential information to the user. Abstraction can be achieved with either abstract classes or interfaces.
Encapsulation is defined 'as the process of enclosing one or more items within a physical or logical package'. Encapsulation, in object-oriented programming methodology, prevents access to implementation details. Abstraction and encapsulation are related features in object-oriented programming.
Polymorphism means "many forms", and it occurs when we have many classes that are related to each other by inheritance. Like we specified in the previous chapter; Inheritance lets us inherit fields and methods from another class. Polymorphism uses those methods to perform different tasks.
Inheritance is one of the fundamental attributes of object-oriented programming. It allows you to define a child class that reuses (inherits), extends, or modifies the behavior of a parent class. The class whose members are inherited is called the base class.