Understanding OOPS
The Simple Way
In this article,i would like to tell you about “Concept of OOPs”
Class
a class is like a blueprint of data member and functios. class is a user-defined data type which holds its own data
Class student //class name
{
int rollno;
char name; // characteristics
void attend classes()
{
… //functions
…
}
}
Object
An object is a self-contained component which consists of methods and properties to make data useful. each object is an instance of particular class
Eg: mobile
Nokia — Vivo-Oppo
Inheritance
When a class derives from another class. child class inherit the properties and characteristics of super class
class mobile //Base class
class Nokia // Derived class
class Samsung //Derived class
Encapsulation
Encapsulation is a concept refers to the creation of self-contained mondules that bind processing functions to the data. These user-defined data types are called “classes”, and one instance of a class is an “object”.
Eg: calculator
Class
{
data member +
methods (behaviours)
}
Abstraction
Abstraction is the concept of OOP that shows only essential attributes and hides unneccesary information
Eg; As a driver you know how to start the car by pressing the start button and internal details of the starting operations are hidden from you. So the entire starting process is hidden from you otherwise we can tell starting operation is encapsulated from you
Polymorphism
Polymorphism is a method in an OOP, that performs different things as per object class, which calls it
Eg;
Man
Emplyee role() — Father role() — Husband Role()
Did you find this article helpful Follow TechWithMK
You should definitely check out my other blogs:
Understand The Concepts of Data Structure