using System; namespace RectangleApplication { class Rectangle { // member variables double length; double width; public void Acceptdetails() { length = 56.2; width = 23.6; } public double GetArea() { return length * width; } public void Display() { Console.WriteLine("长度: "+ length); Console.WriteLine("宽度: "+ width); Console.WriteLine("面积: "+ GetArea()); } } class ExecuteRectangle { static void Main(string[] args) { Rectangle r = new Rectangle(); r.Acceptdetails(); r.Display(); Console.ReadLine(); } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more