Computer Science, asked by rishikatiwari33, 6 hours ago

explain visibility and its types

Answers

Answered by xXRajputXx
5

Explanation:

The visibility of a class, a method, a variable or a property tells us how this item can be accessed. The most common types of visibility are private and public, but there are actually several other types of visibility within C#.

Answered by upsales
1

Answer:

The visibility of a class, a method, a variable or a property tells us how this item can be accessed. The most common types of visibility are private and public, but there are actually several other types of visibility within C#. Here is a complete list, and although some of them might not feel that relevant to you right now, you can always come back to this page and read up on them:

public - the member can be reached from anywhere. This is the least restrictive visibility. Enums and interfaces are, by default, publicly visible.

protected - members can only be reached from within the same class, or from a class which inherits from this class.

internal - members can be reached from within the same project only.

protected internal - the same as internal, except that classes which inherit from this class can reach its members; even from another project.

private - can only be reached by members from the same class. This is the most restrictive visibility. Classes and structs are by default set to private visibility.

Similar questions