`restricted` member variables

forkit forkit at gmail.com
Thu Jun 23 05:22:26 UTC 2022


On Thursday, 23 June 2022 at 05:09:17 UTC, forkit wrote:
>

gather around kids...

This is how encapsulation is achieved.

Each object is in charge of its own state.

Each object keeps that state private.

Other objects don’t have direct access to this state.

Instead, they can only call a list of public functions — called 
methods.

Now if your using the D programming langauge, this isn't the 
entire story. The rest of that story is in that big, black, scary 
book on the top shelf. In that book, you can make a cat bark, if 
you want. But we won't go there. It's too scary!

"How to explain object-oriented programming concepts to a 
6-year-old"

https://www.freecodecamp.org/news/object-oriented-programming-concepts-21bb035f7260/


More information about the Digitalmars-d mailing list