Hi. I don't know if my subject really made sense, so I'll try to explain here. I have a file that contains all my classes, and in those classes are some derived classes with virtual functions in them. Is it possible to put all the code in those virtual functions into a separate file? Such as:
This function is in the actual derived class right now.Code:virtual void displayInfo() { cout << title << endl; cout << author << endl; cout << description << endl; cout << sku << endl; cout << cost << endl; cout << quantity << endl; }
Can I clean it up a bit and make it look like this somehow?
And in a separate .cpp file:Code:virtual void displayInfo() { }
dClass was my derived class by the way.Code:virtual void dClass::vfunction() { cout << title << endl; cout << author << endl; cout << description << endl; cout << sku << endl; cout << cost << endl; cout << quantity << endl; }
Can I take that code out of the class, and put it in a separate .cpp file? I hope this makes sense. The code above didn't work when I tried it that way, but I'm hoping there's someway to do this.
Thanks.



LinkBack URL
About LinkBacks



That worked.