- 15
- 0
- 约3.56万字
- 约 50页
- 2018-06-23 发布于河南
- 举报
C sharp 面向对象与面向过程
* class Shape { protected double width; protected double height; public Shape() { width = height = 0; } public Shape(double x) { width = height = x; } public Shape(double w, double h) { width = w; height = h; } public double area() { return width * height; } } class Triangle : Shape // 三角形 { public Triangle(double x, double y) : base(x, y) { } // 派生类方法与基类方法同名,编译时会有警告信息 new public double area() { return width * height / 2; } } class Trapezia : Shape
原创力文档

文档评论(0)