Instantly share code, notes, and snippets.

anonymous /unit_test_pimpl
Created Oct 2, 2013

Embed
What would you like to do?
// scene.hpp
class Scene
{
public:
Scene();
virtual ~Scene();
virtual void addObject( SceneObject* object );
virtual void render();
private:
class Impl;
Impl& impl_;
};
// scene.cpp
class Scene::Impl
{
public:
void complexProcessing();
void moreComplexProcessing();
void render();
std::vector<SceneObj*> objects_;
};
Scene::Scene():impl_( new Scene::Impl) {}
void Scene::addObject( SceneObject* object )
{
impl_.objects_.push_back( object )
}
void Scene::draw()
{
impl_.complexProcessing();
impl_.moreComplexProcessing();
impl_.render();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment