Answer Posted / bhoomi
The Three OOP Principles
All object-oriented programming languages provide mechanisms that help you implement
the object-oriented model. They are encapsulation, inheritance, and polymorphism.
Let’s take a look at these concepts now.
Encapsulation
Encapsulation is the mechanism that binds together code and the data it manipulates,
and keeps both safe from outside interference and misuse. One way to think about
encapsulation is as a protective wrapper that prevents the code and data from being
arbitrarily accessed by other code defined outside the wrapper. Access to the code
and data inside the wrapper is tightly controlled through a well-defined interface.The power of encapsulated code is that everyone knows how to access it and thus
can use it regardless of the implementation details—and without fear of unexpected
side effects.
Inheritance
Inheritance is the process by which one object acquires the properties of another object.
This is important because it supports the concept of hierarchical classification. As
mentioned earlier, most knowledge is made manageable by hierarchical (that is, top-down)
classifications.However, by use of inheritance, an object need only define those qualities that make it
unique within its class. It can inherit its general attributes from its parent. Thus, it is the
inheritance mechanism that makes it possible for one object to be a specific instance of
a more general case.
Polymorphism
Polymorphism (from the Greek, meaning “many forms”) is a feature that allows one
interface to be used for a general class of actions. The specific action is determined by
the exact nature of the situation.
the concept of polymorphism is often expressed by the phrase “one
interface, multiple methods.” This means that it is possible to design a generic interface
to a group of related activities. This helps reduce complexity by allowing the same
interface to be used to specify a general class of action. It is the compiler’s job to select the
specific action (that is, method) as it applies to each situation. You, the programmer, do
not need to make this selection manually. You need only remember and utilize the
general interface.
Is This Answer Correct ? | 2 Yes | 4 No |
Post New Answer View All Answers
Get me a number puzzle game-program
What is the types of inheritance?
What is encapsulation in simple terms?
What is debug class?what is trace class? What differences are between them? With examples.
What type of loop is a for loop?
Write a program to reverse a string using recursive function?
Why do we use class in oops?
What is use of overloading?
How to hide the base class functionality in Inheritance?
How to use CMutex, CSemaphore in VC++ MFC
What are the 4 main oop principles?
Write a program to sort the number with different sorts in one program ??
What do you mean by variable?
What is and I oop mean?
What is cohesion in oop?