Infosys interview question

What Are The Basic OOPs Principles?

Interview Answer

Anonymous

18 Sept 2024

OOPs have four major basic principles: Abstraction: Abstraction refers to the representation of essential properties without revealing the entire framework. Problems are solved at the 'abstract' or interface level. Encapsulation: Data and the corresponding code are 'encapsulated', that is, combined in a single unit called a class. Inheritance: The existing class properties are 'inherited' by the new child class. For example, if there are two separate child classes such as 'Dog' and 'Cat', they can inherit properties such as 'mammals' and 'pets' from the parent 'Animal' class. Polymorphism: It allows cross-movement between parent and child classes. It is implemented using overriding and overloading.