یک property متشکل از 2 متود set,get است که برای دریافت و یا تخصیص مقادیر به متغیر ها استفاده می شوند.
مثال
کلاس Rect Box را با property بنویسید.
public class Rect Box
}
;private int _width
;private int _height
public int width
}
{;get {retu =width
{;set {_width=value
{
{;get {retu _height
{;set {_height = value
{
public int Area
}
{;get {retu _width * _height
{
public int Surface
}
{;get {retu 2* (_width + _height
{
{
مثال...ما را در سایت مثال دنبال میکنید
برچسب: نویسنده: بازدید: 88