Scope modifiers: Difference between revisions
Content added Content deleted
(Added Kotlin) |
m (Updated for C# 7.2) |
||
Line 300: | Line 300: | ||
protected internal //visible to anything inside the same assembly and also to derived classes outside the assembly. |
protected internal //visible to anything inside the same assembly and also to derived classes outside the assembly. |
||
private //visible only to the current class. |
private //visible only to the current class. |
||
C# 7.2 adds: |
|||
private protected //visible to current class and to derived classes inside the same assembly. |
|||
//Modifier | Class | Assembly | Subclass | World |
//Modifier | Class | Assembly | Subclass | World |
||
Line 307: | Line 309: | ||
//protected | Y | N | Y | N |
//protected | Y | N | Y | N |
||
//internal | Y | Y | N | N |
//internal | Y | Y | N | N |
||
//private | Y | N | N | N |
//private | Y | N | N | N |
||
// C# 7.2: |
|||
//private protected | Y | N | Y/N | N</lang> |
|||
If no modifier is specified, it defaults to the most restrictive one.<br/> |
If no modifier is specified, it defaults to the most restrictive one.<br/> |
||
In case of top-level classes/structs/interfaces/enums this means internal, otherwise it means private. |
In case of top-level classes/structs/interfaces/enums this means internal, otherwise it means private. |