Define OOPS principles
Answer: Object-oriented programming is a programming concept which represents “objects” that have data fields (attributes that describe the object) and associated procedures known as methods. Objects are generally instances of the classes interact with one another to design applications using computer programs.
Concept of OOPS are:
- Abstraction : It’s concept or idea not associated with any specific instance. In another words it’s a technique of hiding actual implementation and share common details through implementation.
- Encapsulation : Hiding internal state and requiring all interaction to be performed through an object’s methods is known as data encapsulation
- Inheritance : A class that is derived from another class is called a subclass (also a derived class, extended class, or child class). The class from which the subclass is derived is called a superclass (also a base class or a parent class).Excepting Object, which has no superclass, every class has one and only one direct superclass (single inheritance). In the absence of any other explicit superclass, every class is implicitly a subclass of Object.Classes can be derived from classes that are derived from classes that are derived from classes, and so on, and ultimately derived from the topmost class, Object. Such a class is said to be descended from all the classes in the inheritance chain stretching back to Object.Classes can be derived from other classes, thereby inheriting fields and methods from those classes called inheritance.
- Polymorphism : It refers to a principle in which an object can have many different forms or stages. Subclasses of a class can define their own unique behaviors and yet share some of the same functionality of the parent class and used in different forms called Polymorphism.