Advertisements
Advertisements
Question
How do abstraction and encapsulation complement each other?
Short Answer
Advertisements
Solution
- Encapsulation combines data and the methods operating on that data into one unit, usually a
class. - Abstraction shows only the essential features of that class and hides complex implementation details.
Thus, encapsulation provides the mechanism to implement abstraction: the class keeps internal details together and exposes only the required public interface.
shaalaa.com
Is there an error in this question or solution?
