在某些情况下,通过限制对类及其派生类的访问权,可以将数据声明为“受保护的”。
In some cases, data can be declared as "protected," with access limited to the class and its derivatives.
与类的成员严格保护能见度是可见的在类中声明它们,和在任何派生类,无论在声明。
Class members with strict protected visibility are visible within the class in which they are declared, and within any descendent class, regardless of where it is declared.
如果显式实现的成员的功能意在由派生类特殊化,则一定要提供具有相同功能的受保护虚拟成员。
Do provide a protected virtual member that offers the same functionality as the explicitly implemented member if the functionality is meant to be specialized by derived classes.
成员是仅用于派生类的实现通常是受保护的。
Members that are intended for use only in the implementation of derived classes are usually protected.
只有在通过派生类类型发生访问时,基类的受保护成员在派生类中才是可访问的。
Theprotected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
只有在通过派生类类型发生访问时,基类的受保护成员在派生类中才是可访问的。
Theprotected keyword is a member access modifier. A protected member is accessible within its class and by derived class instances.
应用推荐