Mega Code Archive

 
Categories / C# Book / 01 Language Basics
 

0124 Accessibilities of get and set

The get and set accessors used to define the logic for the property can have different accessibilities. class Rectangle{ private int width; public int Width{ public get{ return width; } protected set{ width = value; } } } The property should have more accessible modifiers than the get or set accessor