I am very familiar with java, and in java use Interface classes often. Now I am re-learning c++ after a while of not using it, and never having used it for anything majior before.
I am trying to use the c++ equivilent of interfaces, or in other words abstract defenitions to which multiple derived classes need to conform with no actual implementation of the base class.
like most tutorials have you define the 'Vehicle' main class, then 'car', 'bus' and 'train' derived classes.
Most tutorials I have found show you the implementation in clips of code:
but they do nto explain a few things:
Once you define the header file, do you need a .cpp, do you need to compile anything specifically for the interface?
or do you simply include the header in the derived class?
here is a header, chaser.h:
Interface for anything that needs to track on object on the map
virtual void endChase(MapObject&) = 0;
do I need a chaser.cpp file liek this:
using namespace std;
using namespace OpenRPGGDE;
void Chaser::endChase(MapObject& theObject)
or is that completely unneccessary, it compiles fine with g++ -c chaser.cpp -o chaser.o
It seems to me that making a .o file for all the interfaces would not be necessary, but my code is not yet to the point where I can test this yet. As well I would rather not write my code making any assumptions over this. I am going to try and implement a test for this, but I would liek some information to alleviate the headackes I am sure to have over this.
Any help is much appreciated.