首页
IT
登录
6mi
u
盘
搜
搜 索
IT
c#learn
c#learn
xiaoxiao
2021-03-25
135
using
System
;
namespace
RectangleApplication
{
class
Rectangle
{
// 成员变量
double
length
;
double
width
;
public
void
Acceptdetails
()
{
length
=
4.5
;
width
=
3.5
;
}
public
double
GetArea
()
{
return
length
*
width
;
}
public
void
Display
()
{
Console
.
WriteLine
(
"Length: {0}"
,
length
);
Console
.
WriteLine
(
"Width: {0}"
,
width
);
Console
.
WriteLine
(
"Area: {0}"
,
GetArea
());
}
}
class
ExecuteRectangle
{
static
void
Main
(
string
[]
args
)
{
Rectangle
r
=
new
Rectangle
();
r
.
Acceptdetails
();
r
.
Display
();
Console
.
ReadLine
();
}
}
}
转载请注明原文地址: https://ju.6miu.com/read-7311.html
技术
最新回复
(
0
)