class Rectangle {
int x, y;
/* dalsi atributy */
public void moveLeft(int distance) {
x -= distance; repaint();
}
public void moveRight(int distance) {
x += distance; repaint();
}
public void moveUp(int distance) {
y -= distance; repaint();
}
public void moveDown(int distance) {
y += distance; repaint();
}
void repaint() { /* kod */ }
}
class Triangle {
int x, y;
/* dalsi atributy */
public void moveLeft(int distance) {
x -= distance; repaint();
}
public void moveRight(int distance) {
x += distance; repaint();
}
public void moveUp(int distance) {
y -= distance; repaint();
}
public void moveDown(int distance) {
y += distance; repaint();
}
void repaint() { /* kod */ }
}

kubiak
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.