- Популярные видео
- Авто
- Видео-блоги
- ДТП, аварии
- Для маленьких
- Еда, напитки
- Животные
- Закон и право
- Знаменитости
- Игры
- Искусство
- Комедии
- Красота, мода
- Кулинария, рецепты
- Люди
- Мото
- Музыка
- Мультфильмы
- Наука, технологии
- Новости
- Образование
- Политика
- Праздники
- Приколы
- Природа
- Происшествия
- Путешествия
- Развлечения
- Ржач
- Семья
- Сериалы
- Спорт
- Стиль жизни
- ТВ передачи
- Танцы
- Технологии
- Товары
- Ужасы
- Фильмы
- Шоу-бизнес
- Юмор
C# - Part 50 - Access Modifiers | Private | Public | Protected - Tutorial For Beginners
In C#, access modifiers are keywords that define the accessibility of a class, struct, interface, or their members (fields, methods, properties) within your program. They essentially control who can use these elements and enforce a concept called encapsulation.
Here's a breakdown of the different access modifiers:
Public: Members declared as public are accessible from anywhere in your program, regardless of the namespace or assembly. This is typically used for classes, interfaces, methods, and properties that you want to be widely used by other parts of your code.
Private: Private members are only accessible within the class or struct they are declared in. This is useful for encapsulating data and functionality that should be hidden from external code and only used internally by the class.
Protected: Protected members are accessible from the containing class and any classes that inherit from it. This allows derived classes to access and potentially override inherited members.
Internal: Internal members are accessible only from within the same assembly (a compiled unit containing your program's code). This is useful for code that should be shared within a specific project or library but not exposed externally.
protected internal (C# 6 and later): This combines protected and internal access. Members with this modifier are accessible from within the containing class, derived classes (even from different assemblies), and other classes within the same assembly.
private protected (C# 7.2 and later): This combines private and protected internal access. Members with this modifier are only accessible from within the containing class and derived classes within the same assembly.
Видео C# - Part 50 - Access Modifiers | Private | Public | Protected - Tutorial For Beginners канала parvesh
Here's a breakdown of the different access modifiers:
Public: Members declared as public are accessible from anywhere in your program, regardless of the namespace or assembly. This is typically used for classes, interfaces, methods, and properties that you want to be widely used by other parts of your code.
Private: Private members are only accessible within the class or struct they are declared in. This is useful for encapsulating data and functionality that should be hidden from external code and only used internally by the class.
Protected: Protected members are accessible from the containing class and any classes that inherit from it. This allows derived classes to access and potentially override inherited members.
Internal: Internal members are accessible only from within the same assembly (a compiled unit containing your program's code). This is useful for code that should be shared within a specific project or library but not exposed externally.
protected internal (C# 6 and later): This combines protected and internal access. Members with this modifier are accessible from within the containing class, derived classes (even from different assemblies), and other classes within the same assembly.
private protected (C# 7.2 and later): This combines private and protected internal access. Members with this modifier are only accessible from within the containing class and derived classes within the same assembly.
Видео C# - Part 50 - Access Modifiers | Private | Public | Protected - Tutorial For Beginners канала parvesh
Комментарии отсутствуют
Информация о видео
25 мая 2024 г. 17:11:20
00:13:39
Другие видео канала




















