[prev] [index] [next]

Example: Point ADT

PointADT.h gives interface

typedef struct PointRep *Point;

// creates a new point, initally at (x,y)
Point new(float, float);

// returns distance between two Points
float distance(Point, Point);

// moves a Point by dx,dy
void move(Point, float, float);

// destroys a Point
void delete(Point);

Client view:   Point,   new(),   distance(),   move(),   delete()