using System; namespace RectangleApplication { class Rectangle { // 成员变量 double height; double width; public void Acceptdetails() { height = 3; width = 4; } public double GetArea() { return height * width; } public void Display() { Console.WriteLine("Length: {0}",height); 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(); } } }