what is the difference between inheritance and encapsulation with suitable examples
Answers
Answered by
1
Answer:
please search it in google
Answered by
3
Inheritance
Inheritance is the mechanism of basing an object or class upon or class, retaining similar implementation. Also defined as deriving new classes from existing ones such as super class or base class and then forming them into a hierarchy of classes.
Ex- C++
Encapsulation
Encapsulation refers to the bundling of data with the methods that operate on that data, or the restricting of direct access to some of an object's components.
Ex - OOP
Similar questions