Hey!
I’m little confused about those.
What do they do, what are they for?
For examples https://stackoverflow.com/questions/860339/difference-between-private-public-and-protected-inheritance
Two repeat everything else on the internet …
Basically, just as with everything in life, your stuff in your house or your room, everything that belongs to you is private. Anyone who enters your house can see, touch, or use those things. If you allow someone to borrow something then it could also become public or protected - still yours but no longer private.
You can hand stuff off to others and they could then become private, protected, or public via the new owner.
At the same time you want to use the most secure form possible. So you wouldn’t make all your stuff public for instance or certain characters will cause you trouble. But there are things that must be public to be used elsewhere.
Things you do in a class that only that class uses should be private to that class. Other things used from a class in other classes may need to be protected or public depending on how things are being used.
Hopefully that makes some sense to you? Otherwise, you can search the net for probably thousands of examples or maybe a thousand others will reply to this also lol.
Thanks for taking the time to answer!
I googled and it is a bit less unclear now… Didn’t realise it was tied with inheritance.
I first though it was about the users or the coders
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.