次の方法で共有


Protected Members 

Protected members on unsealed classes give developers a way to customize the behavior of a class. For example, methods that raise events are often defined as having protected visibility to allow derived classes to provide additional processing before or after the event is raised.

Important

The term "protected" does not imply any security checking or caller validation. Protected members can be accessed simply by defining a derived class of the declaring type.

Consider using protected members for advanced customization. Protected members are a great way to provide advanced customization without complicating the public interface.

Do treat protected members on unsealed classes as public for the purposes of security, documentation, and compatibility analysis. Arbitrary code can access protected members through subclassing.

Portions Copyright 2005 Microsoft Corporation. All rights reserved.

Portions Copyright Addison-Wesley Corporation. All rights reserved.

For more information on design guidelines, see the "Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries" book by Krzysztof Cwalina and Brad Abrams, published by Addison-Wesley, 2005.

See Also

Other Resources

Design Guidelines for Developing Class Libraries
Designing for Extensibility