抽象方法和类
java
abstract class GraphicObject {
int x, y;
// ...
void moveTo(int newX, int newY) {
// ...
}
abstract void draw();
abstract void resize();
}
java
class Circle extends GraphicObject {
void draw() {
// ...
}
void resize() {
// ...
}
}
class Rectangle extends GraphicObject {
void draw() {
// ...
}
void resize() {
// ...
}
}