Access Modifiers 🤷🏻♂️🚫
Public 🌎
Using Public, an event or a variable can be accessed from outside of the class, where it belongs.
And also from the outside of the assembly.
〰〰〰〰
Private 🔒
It restricts the use of methods and variables only within the class itself.
It can't be used from outside of the class.
As you declare a private constructor of a class, that class can't be accessed from outside that class, you can't create an object of that class.
〰〰〰〰
Protected ⛓
This allows variables and methods to access from that class and the sub class of the class.
That means that methods can be accessed within that class and from the classes, which actually inherit that class.
〰〰〰〰
https://t.me/pgimg/4
#Access_Modifiers
@ProgrammingTip
Public 🌎
Using Public, an event or a variable can be accessed from outside of the class, where it belongs.
And also from the outside of the assembly.
〰〰〰〰
Private 🔒
It restricts the use of methods and variables only within the class itself.
It can't be used from outside of the class.
As you declare a private constructor of a class, that class can't be accessed from outside that class, you can't create an object of that class.
〰〰〰〰
Protected ⛓
This allows variables and methods to access from that class and the sub class of the class.
That means that methods can be accessed within that class and from the classes, which actually inherit that class.
〰〰〰〰
https://t.me/pgimg/4
#Access_Modifiers
@ProgrammingTip
Telegram
Programming Tips Resources