2、基本语法

using System;
namespace RectangleApplication
{
class Rectangle
{
double length;
double width;
public void Acceptdetails()
{
length = 4.5;
width = 3.5;
}
pubilc double GetArea()
{
return length*width;
}
pubilc 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();
}
}
}

posted @ 2019-09-22 16:58  -筱  阅读(98)  评论(0编辑  收藏  举报