What is encapsulation in object oriented programming ? #objectorientedprogramming #cplusplus

preview_player
Показать описание
Encapsulation bundles data (attributes) and methods together inside the wrapper called class.
Similar to capsules where different kind of medicines are are kept together inside the top cover, here data and methods are kept inside top cover called called "class".
To consume medicines inside capsule, first we need to uncover top layer. Similarly here, to access data and methods of class we need to uncover class by creating object for this.
Рекомендации по теме
Комментарии
Автор

Best explanation of encapsulation ever

hjoseph
Автор

Set variable to private and use public getter setter to access data

anomxuser
Автор

Binding Attributes and Methods together inside a class is called as Encapsulation. Is this answer okay?

whatthepine