Encapsulation is one of the fundamentals of OOP (object-oriented programming) and it is used as part of abstraction. Wrapping up data member and method together into a single unit (i.e. Class) is called Encapsulation. This means that a class publishes only what is needed for others to use it, and no more. This is called information hiding and it means classes can totally change their internals without having an effect on any of their users. It is a broader concept of object-oriented programming that consists in minimizing the interdependence between classes and it is typically implemented through information hiding.
Eg: we can consider a capsule. Encapsulation means hiding the internal details of an object, i.e. how an object does something. Here capsule is a single Unit contain many things. But we cant see what is there in side capsule.
Encapsulation is one of the fundamentals of OOP (object-oriented programming) and it is used as part of abstraction. Wrapping up data member and method together into a single unit (i.e. Class) is called Encapsulation. This means that a class publishes only what is needed for others to use it, and no more. This is called information hiding and it means classes can totally change their internals without having an effect on any of their users. It is a broader concept of object-oriented programming that consists in minimizing the interdependence between classes and it is typically implemented through information hiding.
Eg: we can consider a capsule. Encapsulation means hiding the internal details of an object, i.e. how an object does something. Here capsule is a single Unit contain many things. But we cant see what is there in side capsule.
net-informations.com/faq/oops/enca...