[prev] [index] [next]

Exercise: Making Point Less Transparent

The Point implementation above requires clients to directly manipulate Point data, e.g.

Point r;  r.x = 5; r.y = 5;

Suggest additional operations so that we would not need to use Point's internal structure.

Provide implementations for all such operations.

Show how the main function above could be redone using these new operations.