What is Information Hiding in OOP?Encapsulation supports information hiding by making use of the three access specifiers of a class.
Public: If a class member is public, it can be used anywhere without the access restrictions.
Private: if a class member is private, it can be used only by the members and friends of class.
Protected: if a class member is protected, it can be used only by the members and friends of class and the members and friends of classes derived from class.What is Information Hiding in OOP?Information hiding is the primary criteria of system modularization and should be concerned with hiding the critical decisions of OOP designing. Information hiding isolates the end users from the requirement of intimating knowledge of the design for the usage of a module. What is Information Hiding in OOP?Information hiding concept restricts direct exposure of data. Data is accessed indirectly using safe mechanism, methods in case of programming object. Taking bike as an example, we have no access to the piston directly, we can use 'start button' to run the piston. You can understand the advantage of information hiding concept from this example. If a bike manufacturer allows direct access to piston, it would be very difficult to control actions on the piston.
|