previous | start | next

## When Not to Use Inheritance

- From a tutorial for a C++ compiler:

    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 | start | next