What is encapsulation in object oriented programming ?

Поділитися
Вставка
  • Опубліковано 26 сер 2024
  • 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.

КОМЕНТАРІ • 5

  • @hjoseph777
    @hjoseph777 2 місяці тому

    Best explanation of encapsulation ever

  • @anomxuser
    @anomxuser 8 місяців тому +9

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

    • @cyrusol
      @cyrusol 4 місяці тому

      So sad that this is the understanding of OOP among most people...

  • @mrchrunchasmr
    @mrchrunchasmr 6 місяців тому

    great vid

  • @vaibhavutekar8215
    @vaibhavutekar8215 Рік тому +3

    He hides the object