Пространства имён
Варианты
Действия

access specifiers

Материал из cppreference.com

 
 
Язык С++
Общие темы
Управление программой
Операторы условного выполнения
Операторы повторения
Операторы перехода
Функции
объявление функции
объявление лямбда-функции
шаблон функции
спецификатор inline
спецификаторы исключений (устарело)
спецификатор noexcept (C++11)
Исключения
Пространства имён
объявление пространства имён
псевдонимы пространства имён
Типы
спецификатор decltype (C++11)
Спецификаторы
cv-спецификаторы
спецификаторы продолжительности хранения
спецификатор constexpr (C++11)
спецификатор auto (C++11)
спецификатор alignas (C++11)
Инициализация
Литералы
Выражения
Утилиты
Типы
typedef-объявление
объявление псевдонима типа (C++11)
атрибуты (C++11)
Приведения типов
неявные преобразования
const_cast-преобразование
static_cast-преобразование
dynamic_cast-преобразование
reinterpret_cast-преобразование
C-подобное и функциональное приведение типов
Выделение памяти
Классы
объявление класса
указатель this
спецификаторы доступа
Особые свойства классовых функций
Специальные функции-члены
Шаблоны
шаблон класса
шаблон функции
специализация шаблона
упакованные параметры (C++11)
Разное
Ассемблерные вставки
 
В class или органа struct определить видимость следующих declarators
Original:
In a class or struct body define the visibility of following declarators
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
В списке наследования, определить максимальную видимость унаследованных членов
Original:
In a inheritance list, define the maximum visibility of inherited members
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Синтаксис

public: declarators (1)
protected: declarators (2)
private: declarators (3)
class identifier : public class_name (4)
class identifier : protected class_name (5)
class identifier : private class_name (6)

[править] Объяснение

# Символы, объявленные после спецификатора есть общественный доступ
Original:
# The symbols declared after the specifier have public accessibility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Символы, объявленные после спецификатора защитили доступности
Original:
# The symbols declared after the specifier have protected accessibility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Символы, объявленные после спецификатора есть частные доступности
Original:
# The symbols declared after the specifier have private accessibility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Унаследованные имеют одинаковую доступность в качестве базового класса (либо охраняемых или общественности, как частных, не будет виден в производном классе)
Original:
# The inherited members have the same accessibility as the base class ( either protected or public as private won't be visible in the derived class )
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Унаследованные защитили доступности в производном классе
Original:
# The inherited members have protected accessibility in the derived class
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
# Унаследованные у частного доступа в производном классе
Original:
# The inherited members have private accessibility in the derived class
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.

[править] Член доступности спецификатор

, Общественности
Original:
;public
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Члены общественного доступны везде, внутри и за пределами области видимости класса
Original:
public members are accessible everywhere, within and outside the class scope
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
, Защищено
Original:
;protected
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Защищенные члены доступны внутри класса и его методов и его потомков
Original:
protected members are accessible within the class and its methods and in its descendants
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
, Частные
Original:
;private
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
частные члены могут быть доступны только внутри класса и его методов
Original:
private members can be only accessed within the class and its methods
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Чтобы предоставить доступ к внешним функциям или классам защищенных или частных членов, Дружба декларации должны присутствовать в теле класса
Original:
To grant access to external functions or classes to protected or private members, a Дружба декларации must be present in the class body
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
Унаследованные закрытые члены все еще присутствуют в классе данных, но не могут быть доступны напрямую
Original:
Inherited private members are still present in the class data but cannot be accessed directly
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.
class имеет по умолчанию частных доступности для наследования и членов struct имеет вместо доступность умолчанию общественности
Original:
A class has default private accessibility for inheritance and members, a struct has instead a default public accessibility
The text has been machine-translated via Google Translate.
You can help to correct and verify the translation. Click here for instructions.