Skip to content

Instantly share code, notes, and snippets.

@VessoVit
Created November 2, 2013 15:07
Show Gist options
  • Save VessoVit/7279846 to your computer and use it in GitHub Desktop.
Save VessoVit/7279846 to your computer and use it in GitHub Desktop.
simple example of using vectors to hold references to subclasses
class Boid {
};
class First : public Boid {
};
class Second : public Boid {
}
//testApp
vector<Boid*> boids;
........
Boid boids;
First first;
Second second;
boids.push_back(&boids);
boids.push_back(&first);
boids.push_back(&second);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment