SE450: When Not to Use Inheritance [62/65] Previous pageContentsNext page

public class Point 
{
public Point(int anX, int aY) { ... }
public void translate(int dx, int dy) { ... }
private int x;
private int y;
}

public class Circle extends Point // DON'T
{
public Circle(Point center, int radius) { ... }
public void draw(Graphics g) { ... }
private int radius;
}

Previous pageContentsNext page