0

I am Just beginer, and i can not understand What is the Main difference between privet and protected in c#?

6th Sep 2019, 7:31 AM
ŠŸŠ°Š²ŠµŠ»
3 Answers
0
Protected The second level is ā€œprotected.ā€ Protected properties and methods can be accessed from inside the class they are declared, or in any class that extends them. They canā€™t be accessed from outside the class or subclass. Private While protected properties and methods are accessible anywhere in the object, the third level ā€œprivateā€ is more restrictive. A private property or method canā€™t be accessed by a subclass of the class it is defined in. If you have a class with a protected property and a private property and then extend that class in the subclass, you can access the protected property, but not the private property. Hope you may understand~
6th Sep 2019, 7:41 AM
Uchiha Itachi
Uchiha Itachi - avatar
6th Sep 2019, 7:50 AM
Krysto Foxik šŸ„
Krysto Foxik šŸ„ - avatar
0
Privet Š—Š“Š°Ń€Š¾Š²Š°Š°Š°Š° šŸ˜‰ Full list of access modifiers: Public - can be accessed from anywhere. Protected - can be accessed from classes which derive from this class. Internal - can be accessed only within defined dll\application Private - can be accessed only within a class p.s. Internal protected is also a valid access modifier
6th Sep 2019, 7:01 PM
Izzatkhon Shamsiev