Sdílet prostřednictvím


private Modifier

Declares that a class member has private visibility.

private statement

Arguments

  • statement
    Required. A class member definition.

Remarks

The private modifier makes a member of a class visible only within that class. Code outside the current class, including derived classes, cannot access private members.

Classes and interfaces in the global scope cannot be marked with the private modifier. Any member of a class or interface (including nested classes and nested interfaces) can be marked with the private modifier.

You may not combine the private modifier with any of the other visibility modifiers (public, protected, or internal).

Requirements

Version .NET

See Also

Reference

public Modifier

protected Modifier

internal Modifier

var Statement

function Statement

class Statement

Concepts

Scope of Variables and Constants

Other Resources

Modifiers