Merged Classes (2)
Client methods often convert multiple data items - for example, 2D vector conversions invoke a pair of internal set and get functions:
- void polar2rect(float r, float a, int* px, int* py);
- void rect2polar(int x, int y, float *pr, float *pa);
In effect these become subtypes of the Point class. An object will exist in both subclasses concurrently.
If not atomic, they must recover from exceptions.
To do their work they can call on single-output functions (next slide).