Why use private variable declaration? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why use private variable declaration?

You can use private but anyone can change your private variable by using “friend” annotation with a function.

15th Jul 2018, 4:02 PM
Goblin
Goblin - avatar
1 Answer
0
What language is this? Some languages do not allow you to access private variables at all. If they do but only under certain circumstances or give you a warning, I guess they are allowing you to be flexible, and just let you know this variable should not be accessed so you can weigh the costs.
27th Jul 2018, 4:07 PM
Alexander
Alexander - avatar