Possible Duplicate:
pure virtual function and abstract class
I have a class and I want to create a virtual function that will be used to print debug information. Any class that inherits this class will have to implement this virtual function. This way different classes could print the debug messages to different output devices such as std::cout
, labels, files etc.
The base class won't be aware of the messages destination. But I don't know the best way to do this. I'm thinking of using something like printf()
which can print an arbitrary number of parameters. But I don't know what that would be accomplished. Any ideas?