2段階目(抽象クラスとインターフェースを使ってみよう)

This commit is contained in:
s-sakiyama
2026-09-16 13:12:58 +09:00
parent 03c7af9751
commit 551f5a4fe2
6 changed files with 56 additions and 4 deletions

18
em-oop/src/Rectangle.java Normal file
View File

@@ -0,0 +1,18 @@
public class Rectangle extends Shape {
private double width;
private double height;
public Rectangle(double width, double height) {
super("四角形");
this.width = width;
this.height = height;
}
@Override
public double area() {
return width * height;
}
}