خرید بک لینک
کلاس Rectbox با قابلیت های امکان تنظیم و دریافت طول و عرض مستظیل امکان محاسبه ی محیط و مساحت مستطیل را خواهیم دید :

public class RectBox
{
private int _width;
private int _height;
public void Setwidth(int w)
{
_width = w;
}
public int Getwidth() => _width;

public void Setheight(int h)
{
_height = h;
}
public int Getheight() => _height;
public int Area() => _height * _width;
public int Surface() => (_width * _height) * 2;
}

و کاربرد ان به صورت زیر است:

RectBox b = new RectBox();

b.setwidth(10);

b.setheight(5);

int a =b.area();

برچسب: نویسنده: پویا فراهانی تاريخ: چهارشنبه 24 آبان 1396 ساعت: 5:36

صفحه بندی