Объсните, пожалуйста, как работает public и privat в C#? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Объсните, пожалуйста, как работает public и privat в C#?

3rd Jun 2023, 4:22 PM
Сын Сатурна
Сын Сатурна - avatar
1 Answer
+ 2
You can find a complete explanation in the language reference. https://learn.microsoft.com/en-us/dotnet/csharp/programming-guide/classes-and-structs/access-modifiers Generally public means it is accessible from anywhere, including from other classes and even from other programs. Private can only be accessed within the same class or struct. There are also some other access levels inbetween (protected, internal...).
3rd Jun 2023, 4:31 PM
Tibor Santa
Tibor Santa - avatar