Combining Separate Classes
Use a single name, print, for the operation of printing to a stream:
void print (const Apple & a, ostream & out) { a.printOn(out);}void print (const Orange & a, ostream & out){ a.writeTo(out);}
Previous slide
Next slide
Back to first slide
View graphic version