public Class RectBox
}
;private int _height
;private int _weight
;(public void(int h
}
;height=h_
{
()public int Getheight
}
;retu _height
{
( public void Setwidth (int w
}
; width=w_
{
()public int Getwidth
}
;retu _width
{
()public int Area
}
;retu _width*_height
{
()public int Surface
}
;(retu 2*(_width + _height
{
;()RectBox box =new Rectbox
;(10)Box.Setwidth
;(20)Box.Setheight
;()int a=box.Area
;()int s=box.surface
در قسمت Set,فیلدطول و عرض را مقداردهی میکنیم و در قسمت get,اجازه میدهیم مقداری را از فیلد استخراج کند.و در قسمت;()RectBox box =new Rectbox در واقع هم box را تعریف کرده و هم آن را میسازیم همان definition /creation.
ما را در سایت enumaration types دنبال میکنید
برچسب: نویسنده: بازدید: 81