https://leetcode.
com/discuss/study-guide/1389824/One-Stop-OOP-Guide-or-Useful-and-Short-
topics-for-interviews-or-Object-Oriented-Programming-(C%2B%2B)
OOP in C++ :
1. It works on concepts of classes and objects.
2. data is treated as a critical element, so there will be rules to manage access to this data.
3. Class :
a. It is building block of objects
b. It is a blueprint or template of an object, like what properties and functionalities
an entity should have.
c. when we define a class, it doesn’t allocate space in memory.
d. when we create an object (instance of class) then space gets allocated in
memory.
e. class can be considered as a user defined data type.
4. Objects : are run time entities and instances of class.
5. Encapsulation :
a. wrapping data and methods into single unit(like class)
b. It also leads to abstraction or data hiding, as using encapsulation also hides data.
6. Data Abstraction :
a. Displaying only necessary information and hiding the details
b. It refers to providing only essential info about data to outside world and hiding the
details or implementation.
c. It can be achieved using class, and in class we can use access specifiers to
manage privacy of data
7. Inheritance :
a. using properties and methods of one class into another class. (code reusability)
b. Inheritance supports the concept of reusability of code
8. Polymorphism :
a. ability to take multiple forms as per different situations.
b. Operator overloading & function overloading
c. Operator overloading : making an operator behave differently in different
situations. For example, we define ‘+’ operator for adding two strings, ‘+’ can be
used to add numbers as well as strings.
d. Function overloading : making a single function name behave differently in
different situations.
i. Functions name will be the same but there will be difference in the
number or type of parameters passed to the functions.
ii. When the number of parameters are different in different functions.
iii. When the type of parameters differs in different functions.
e. Function overriding : when child/derived class defines the same function from
parent/base class with same or modified implementation then it is called function
overriding, inheritance is required for this.
f. Operator overloading and function overloading are compile time polymorphism
While function overriding is run-time polymorphism.
g. polymorphism is used in implementing inheritance.
9. Dynamic binding : the code to be executed in response to a function call will be
decided at runtime.