Skip to content

Instantly share code, notes, and snippets.

@paytonrules
Last active August 29, 2015 13:56
Show Gist options
  • Save paytonrules/8996835 to your computer and use it in GitHub Desktop.
Save paytonrules/8996835 to your computer and use it in GitHub Desktop.
class ExternalRouter
{
private:
static ExternalRouter *_instance;
protected:
ExternalRouter();
public:
static ExternalRouter *instance();
static void setTestingInstance(ExternalRouter *newInstance);
}
void ExternalRouter::setTestingInstance(ExternalRouter *newInstance)
{
delete _instance;
_instance = newInstance;
}
class TestingExternalRouter : public ExternalRouter
{
public:
virtual void Dispatcher *getDispatcher() const {
return new FakeDispatcher();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment