Original Post
hello, a little while ago i took a look into java and really liked the way the language implemented the use of interfaces, but i still wanted to code in c++ so i began to use interfaces to help me program more OO, however lately i've started to use interfaces for organization purposes aswell and just wanted everyones opinion on what they think. to me it does sorta seem like a wasteful thing to do, i'll give an example below. ok first off, how i'd normally use an interface. that's the general idea on what i've been doing, but lately i've been doing this. i guess it's not an interface anymore in the following example though. basically in this situation the interfaces exsist only to help me distinguish which classes have what functionality, but no class actually will use the above interfaces to perfrom any tasks. should i steer clear of this?
class CGameCore {
IEventInput* inputReceiver;
public:
CGame(IEventInput *ieventinput) : inputReceiver(ieventinput) { }
};
class GameCode : public IEventInput {
private:
CGameCore *core;
public:
GameCode() {
CGameCore = new CGameCore(this);
}
}
struct INeedToUpdate {
virtual void update() = 0;
virtual void getStatus() = 0;
}
class AnyClass : public INeedToUpdate {
};
class SomeUnrelatedClass : public INeedToUpdate {
};