Object Oriented Programming (OOPS Concept)

If we solve a problem in terms of class and object it is called object oriented programming.

There are four attributes that are use in oops.

1-class:- class provides definition for an object or we can say that class is a collection of entities

2-Objet:- it is an instance of the class

3. Properties:- characteristics of an object using which we can differentiate one object from another object.

4. Methods:- Operation that can be perform over an object.

OOPS Concept:-

1. Abstraction:- abstraction refers to hiding the detail. When a class given to the user he is familiar only abstract view of detail internal detail and implementation are hidden from the rest of the user. . it works with respect of the class User.

2. Encapsulation:- the process of binding function and variable together within class body it is called Encapsulation. it works with respect of the class designer.

3. Inheritance:- it is the process of creating new classes from already existing classes. New classes can inherit the properties of the already existing classes plus it can add its own additional functionality .in java already existing classes are known as super class and new classes are known as sub class. it is use for code reusability.

Types of inheritance:
1. Single level inheritance
2. Multilevel inheritance
3. Multiple inheritance
4. Hierarchical inheritance
5. Hybrid inheritance

Note:- Multiple inheritance are not allowed in java it is compile time error.

4. Polymorphism:- if same message is passed to different object each object response differently depending upon its class it is called polymorphism.

Polymorphism is of two types.
1. Compile time polymorphism
2. Run time polymorphism
Example of compile time polymorphism:- function overloading , operator overloading.

Example of run time polymorphism:- Default in java and in c++ achieve by virtual function