access specifiers
Материал из cppreference.com
|
|
This page has been machine-translated from the English version of the wiki using Google Translate.
The translation may contain errors and awkward wording. Hover over text to see the original version. You can help to fix errors and improve the translation. For instructions click here. |
В 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.
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.
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.
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.
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.
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.
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.
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.
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.
You can help to correct and verify the translation. Click here for instructions.
- Члены общественного доступны везде, внутри и за пределами области видимости классаOriginal:public members are accessible everywhere, within and outside the class scopeThe 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.
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 descendantsThe 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.
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 methodsThe 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.
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.
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.
You can help to correct and verify the translation. Click here for instructions.
| Этот раздел не завершён Причина: example |