Four Principle In OOP

* What is the four different Properties In OOP?

Ans: In OOP there are four properties in OOP.To maintain the relationship with a object with others OOP maintain four properties strongly.These are:
  1. Inheritance
  2. Polymorphism
  3. Encapsulation
  4. Abstraction
*What is Inheritance?
Ans: In our Car object(my previous post) we defined a Car class which from same manufacturer.But if we consider that car objects from different manufacturer then these cars also have some similar properties that we defined our previous class.So for different manufacturer we can inherits this Car class. then we can call this class as super class and from which class it will be inherited it will be called as subclass.
For example:
class BMW extends Car{
//define new methods and variables
}
**details will be provided soon
*What is polymorphism?
Ans: Poly = many and morphs = forms. So we can say that polymorphism means many form of a method.
For example:
If we consider some method of a class that contains same name but accept different number  parameters.
**detail will be provided soon
*What is Encapsulation?
Ans: Data Hiding from another user or class.We use Different access modifier to use encasulation property such as default,public,private,protected.
**detail will be provided soon
*What is Abstartion?
Ans: Abstraction is the technique of hiding implementation.

Reactions

Post a Comment

0 Comments