The Circle class can be rewritten as a specific implementation of the general (or abstract) Shape class.
The Circle class can be rewritten as a specific implementation of the general (or abstract) Shape class.
The Circle class can be rewritten as a specific implementation of the general (or abstract) Shape class.
In doing so, it inherits most of the useful state and behaviour...
In doing so, it inherits most of the useful state and behaviour...
In doing so, it inherits most of the useful state and behaviour...
...leaving only the task of how to draw this specific shape.
class Circle {
protected int x=50, y=50;
protected int size=20;
public void moveTo(int xpos, int ypos){
x=xpos; y=ypos;
}
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle *{
protected int x=50, y=50;
protected int size=20;
public void moveTo(int xpos, int ypos){
x=xpos; y=ypos;
}
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle extends Shape {
protected int x=50, y=50;
protected int size=20;
public void moveTo(int xpos, int ypos){
x=xpos; y=ypos;
}
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle extends Shape {
protected int x=50, y=50;
protected int size=20;
public void moveTo(int xpos, int ypos){
x=xpos; y=ypos;
}
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle extends Shape {
protected int x=50, y=50;
protected int size=20;
public void moveTo(int xpos, int ypos){
x=xpos; y=ypos;
}
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle extends Shape {
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}
class Circle extends Shape {
public void draw(java.awt.Graphics g){
g.drawOval(x, y, size, size);
}
}