Question
Which OOP concept ensures that the internal details of
an object are hidden from the outside world, providing a clear interface for interaction?Solution
Encapsulation is a cornerstone of OOP that enforces data hiding by restricting direct access to an object’s internal state. 1. Data Protection: By using access modifiers (e.g., private, protected), encapsulation shields sensitive data from external manipulation. 2. Clear Interfaces: Through getter and setter methods, encapsulation provides controlled interaction with an object’s data, ensuring integrity and security. 3. Modularity: Encapsulation helps developers manage code complexity by compartmentalizing data and behavior within distinct classes. Thus, encapsulation creates a robust framework for managing dependencies and ensuring secure object interactions. Why Other Options Are Incorrect: • A) Abstraction: Focuses on hiding implementation details but differs by emphasizing interface design. • B) Polymorphism: Deals with dynamic behavior and method variability, unrelated to data hiding. • D) Inheritance: Describes property/method sharing between classes, not encapsulation. • E) Composition: Involves constructing objects using other objects, unrelated to access control.
Opinion on relationship:
According to the Companies Act, what is the minimum number of directors required in a public company?
What does "social security" include as per the Code on Social Security?
When was Criminal Procedure Code enacted?
The duties of Designated Partner under the LLP Act are____________
Mark the correct sequence of stages in a crime:
Transfer by Ostensible Owner is discussed under which section of the Transfer of Property Act?
As per the Prevention of Corruption Act, 1988 taking undue advantage to influence public servant by corrupt or illegal means or by exercise of personal ...
According to the provisions of the IBC where any person is a financial creditor as well as an operational creditor such person shall_______________________
According to the SEBI Act all sums realized by way of penalties can be ____________