You are on page 1of 2

Object-Oriented Programming

OOP stands for Object-Oriented Programming.

object-oriented programming is about creating objects that contain both data


and methods.

Tip: The "Don't Repeat Yourself" (DRY) principle is about reducing the
repetition of code. You should extract out the codes that are common for the
application, and place them at a single place and reuse them instead of
repeating it.

Classes and objects are the two main aspects of object-oriented


programming.

So, a class is a template for objects, and an object is an instance of a class.

When the individual objects are created, they inherit all the variables and
methods from the class.

Class 1:Add(),Sub() and Mul().

Class 2: created obj of class one and using dot(.) operator we inherit the
methods

Example:

Class Fruits

Object:

Apple,mango etc

Class Car:

Object:

Maruti,BMW,AUDI

Example:

If You are starting a company.


Employess:Noun
Adjective:Int Employe id,String Emp Dept,Double Salary.
Verbs:
getsalary();
getEmpid();
getEmpDep();

Object oriented 4 pillars:


Abstraction:
Abstraction is a process of hiding the implementation details and showing only
functionality to the user.
Best example: Mobile,car

Encapsulation:
Capsule:
Inheritance:
Polymorphisam: overloading and overriding

You might also like