EDM FAQ: The print() method


The print method is supposed to provide a reasonably formatted print outof the state of an object. It is up the class designer nowadays to decide what a reasonable print out looks like. The signature for print is:

public: virtual void print(std::ostream& output = std::cout) const ;

For those unfamiliar with C++, this means that there are really two print methods declared in StorableObject, one with std::cout assigned to "output" and one with the user passing in the argument "output". In plain declarations, this looks like:

public: virtual void print(void) const ;  // output = std::cout
public: virtual void print(std::ostream& output) const ;

Only one implementation is required, however, based on the second plain declaration.


Comments on this page may be sent to Rob Kennedy