Information Hiding VS Encapsulation

146 Views Asked by At

We know that encapsulation binds the data members and member functions into a bounded scope.Now anyone who has to make changes to the data(for eg. private data) has to get into the scope of the class.So when we talk about data hiding, can we say that SCOPE OF PUBLIC MEMBERS IS GLOBAL?,as they can be accessed anywhere. If yes,then isn't it that it violates the rule of encapsulation(in which scope is bounded)?

1

There are 1 best solutions below

0
Helio On

A public member isn't global if it isn't also static, for access to a (non static) public member you need to create an object of that class so that don't break the concept of encapsulation.