day09-继承抽象案例--图形

This commit is contained in:
2026-07-25 16:54:42 +08:00
parent 1997cf8be2
commit 62018f2ffa
5 changed files with 138 additions and 0 deletions
@@ -0,0 +1,20 @@
package com.inmind.test08;
public class Rectangle extends Shape{
//继承中构造方法的传递值的方式,指定属性值
public Rectangle(double chang ,double width){
super(chang,width);
}
@Override
public double getArea() {
return getChang()*getWidth();
}
@Override
public double getZC() {
return 2*(getChang()+getWidth());
}
}