FEATURES OF OOPS
1)What is Object?
REAL TIME EXAMPLE:
Let us take Mobile Phone as an Object.
Mobile Phone's state and behavior as follows:
2)What is Class?
REAL TIME EXAMPLE:
Mobile Phone's Data member and Member function as follows:
EXAMPLE:
class Mobile{
int IMEI = 863150304512345;
int IP = 192161516;
int mobile_num=""9876543210;
String Mobile_Brand = "Oppo";
void call(int from, int to)
{
Function body;
}
void songs(String song)
{
Function body;
}
}
3)What is Inheritance?
REAL TIME EXAMPLE:
FATHER-SON relationship.
Superclass - Father.
Subclass - Son.
Method or Properties - Father's asset, Father's characteristics.
Types of Inheritance:
Read More: Inheritance And Types of Inheritance
4)What is Polymorphism?
Circumstances.
REAL TIME EXAMPLE:
A person can play many roles in his\her life.
Lets take women as an example,
She plays the role of
★Daughter for her parents,
★Student in her school,
★Mother for her children etc..
Types of Polymorphisms:
5)What is Encapsulation:
Encapsulation can be defined by data hiding and Data binding.
DATA HIDING:
Data hiding is the process of hiding unwanted information or details.
REAL TIME EXAMPLE:
In Bluetooth sharing, A's private data cannot be accessed by B's mobile except the files shared by A to B.
DATA BINDING:
Process of binding\wrapping the data members and member functions together as a unit class.
REAL TIME EXAMPLE:
Capsule which contains variety of medicines wrapped inside it.
In simple words, Encapsulation can be defined as the Process of binding data members and member functions together to do a specific job without revealing unnecessary details or information.
6)What is Abstraction?
REAL TIME EXAMPLE:
Making a call from one phone to another in which we don't know the internal process of converting digital signals to analog signal or vice versa, we just dial the number and make a call.
Types of Abstraction:
0 Comments