What is Object Oriented Programming?
Object-Oriented Programming(OOPs) is a type of programming that is based on objects rather than just
functions and procedures. Individual objects are grouped into classes. OOPs implements real-world entities like
inheritance, polymorphism, hiding, etc into programming. It also allows binding data and code together.
Why use OOPs?
OOPs allows clarity in programming thereby allowing simplicity in solving complex problems
Code can be reused through inheritance thereby reducing redundancy
Data and code are bound together by encapsulation
OOPs allows data hiding, therefore, private data is kept confidential
Problems can be divided into different parts making it simple to solve
The concept of polymorphism gives flexibility to the program by allowing the entities to have multiple
forms
What are the main features of OOPs?
Inheritance
Encapsulation
Polymorphism
Data Abstraction
What is an object?
An object is a real-world entity which is the basic unit of OOPs for example chair, cat, dog, etc.
Different objects have different states or attributes, and behaviors.
What is a class?
A class is a prototype that consists of objects in different states and with different behaviors. It has a
number of methods that are common the objects present within that class.
What are the different types of inheritance?
Single inheritance
Multiple inheritance
Multilevel inheritance
Hierarchical inheritance
Hybrid inheritance
What is a superclass?
A superclass or base class is a class that acts as a parent to some other class or classes. For example,
the Vehicle class is a superclass of class Car.
What is a subclass?
A class that inherits from another class is called the subclass. For example, the class Car is a subclass
or a derived of Vehicle class.
What is method overloading?
Method overloading is a feature of OOPs which makes it possible to give the same name to more
than one methods within a class if the arguments passed differ.
What is method overriding? - Method overriding is a feature of OOPs by which the child class or the subclass
can redefine methods present in the base class or parent class. Here, the method that is overridden has the
same name as well as the signature meaning the arguments passed and the return type.