名前空間
変種
操作

access specifiers

提供: cppreference.com
< cpp‎ | language

 
 
C++言語
一般的なトピック
フロー制御
条件付き実行文
繰り返し文 (ループ)
ジャンプ文
関数
関数宣言
ラムダ関数宣言
inline 指定子
例外指定 (非推奨)
noexcept 指定子 (C++11)
例外
名前空間
指定子
decltype (C++11)
auto (C++11)
alignas (C++11)
記憶域期間指定子
初期化
代替表現
リテラル
ブーリアン - 整数 - 浮動小数点
文字 - 文字列 - nullptr (C++11)
ユーザ定義 (C++11)
ユーティリティ
属性 (C++11)
typedef 宣言
型エイリアス宣言 (C++11)
キャスト
暗黙の変換 - 明示的な変換
static_cast - dynamic_cast
const_cast - reinterpret_cast
メモリ確保
クラス
アクセス指定子
friend 指定子
クラス固有の関数特性
特別なメンバ関数
テンプレート
その他
 
classまたはstruct本体で以下のような宣言子の可視性を定義します
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.
#継承されたメンバは、基本クラスと同じアクセシビリティを(どちらかprotectedまたはpublic、privateとして、派生クラスでは表示されません)を持っています
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.
protectedまたはprivateメンバに外部の関数やクラスへのアクセスを許可するには、友情宣言はクラス本体内に存在する必要があります
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.