static void Main(string[] args) { Rectangle r = new Rectangle(); r.setWidth(5); r.setHeight(7); Console.WriteLine("总面积:{0}", r.getArea()); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); Rect.setWidth(5); Rect.setHeight(7); // Print the area of the object. Console.WriteLine("Total area: {0}", Rect.getArea()); }
static void Main(string[] args) { Rectangle r = new Rectangle(); int area; r.setWidth(5); r.setHeight(7); area = r.getArea(); Console.WriteLine("总面积:{0}", r.getArea()); Console.WriteLine("油漆总成本:{0}", r.getCost(area)); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); Rect.setWidth(5); Rect.setHeight(7); // 打印对象的面积 Console.WriteLine("总面积: {0}", Rect.getArea()); Console.ReadKey(); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); int area; Rect.setWidth(5); Rect.setHeight(7); area = Rect.getArea(); // Print the area of the object. Console.WriteLine("Total area: {0}", Rect.getArea()); Console.WriteLine("Total paint cost: ${0}", Rect.getCost(area)); Console.ReadKey(); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); // 调用基类的方法 Rect.setWidth(5); Rect.setHeight(7); // 打印对象的面积 Console.WriteLine("总面积: {0}", Rect.getArea()); Console.ReadKey(); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); Rect.setWidth(5); Rect.setHeight(7); Console.WriteLine("Total area: {0}", Rect.getArea()); Console.ReadKey(); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); int area; Rect.setWidth(5); Rect.setHeight(7); area = Rect.getArea(); // 打印对象的面积 Console.WriteLine("总面积: {0}", Rect.getArea()); Console.WriteLine("油漆总成本: ${0}", Rect.getCost(area)); Console.ReadKey(); }
static void Main(string[] args) { //Instantiation of derived class creating space in memory and giving back reference pointer to this object Rectangle Rect = new Rectangle(); //Rectangle using setter methods from the base class to set the values of inherited data members Rect.setWidth(5); Rect.setHeight(7); // Print the area of the object. Console.WriteLine("Total area: {0}", Rect.getArea()); Console.ReadKey(); }
static void Main(string[] args) { Rectangle Rect = new Rectangle(); int x, y; Console.WriteLine("Enter width of rectangle: "); string tempX = Console.ReadLine(); int.TryParse(tempX, out x); Console.WriteLine("Enter heigh of rectangle: "); string tempY = Console.ReadLine(); int.TryParse(tempY, out y); Rect.setWidth(x); Rect.setHeight(y); // Print the area of the object. Console.WriteLine("Total area: {0}", Rect.getArea()); Console.ReadKey(); }