I have a base class called ModelFile
I have derived classes called ObjFile and VtkFile that I would like both to use << from ModelFile.
However, since << is an external function,
ostream & operator << (ostream &output, const ModelFile &Model)
{
output << "Num Vertices: " << Model.NumVertices() << endl
<< "Num Triangles: " << Model.NumTriangles() << endl;
return output;
}
The compiler doesn't know about
ostream & operator << (ostream &output, const ObjFile &Obj)
Is there a way to do this?
Thanks,
Dave