Answer to Question #264725 in C++ for Sami

Question #264725

Question 2a: Explain further on the three main principles of Object-Oriented Programming


1
Expert's answer
2021-11-12T00:54:58-0500


SOLUTION TO THE ABOVE QUESTION


ANSWER.

I)Inheritance

Inheritance is a mechanism in which one class acquires the property of another class.

The class that acquires the properties of another class is called a sub-class or the child class

while whose properties are inherited is called the base class. For example, the relationship between person and a student, a student class can acquire some properties from the person class like name and age because every person has a name and is several years old and also a student is a person.


II)Encapsulation

Encapsulation in java is process where the internal implementation of a class 

is hidden from the outside world. In java we encapsulate by making the data members of a class private. The variables of a class that are declared as private will be hidden from other classes i.e 

they can not be accessed directly, they can be accessed only through the methods of their current class.


III)Polymorphism

Polymorphism in Java is the ability of an object to take many forms. Polymorphism in java allows us to perform the same action in many different ways i.e. we can perform a single task in different ways.


Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS