Accessibilities of properties
In this chapter you will learn:
Control accessibilities of properties
The get
and set
accessors
used to define the logic for the property can have
different accessibilities.
class Rectangle{//from ja v a 2s . c o m
private int width;
public int Width{
public get{
return width;
}
protected set{
width = value;
}
}
}
Next chapter...
What you will learn in the next chapter:
- What is automatic properties and how to use automatic properties in C#
- How to use the automatic properties
Home » C# Tutorial » Class