Like I said, I've never used it.GyroVorbis wrote:Haha, isn't that the basis of polymorphism?dandymcgee wrote:I always forget you can treat derived class objects as if they were their parent's type

Moderator: Coders of Rage
Like I said, I've never used it.GyroVorbis wrote:Haha, isn't that the basis of polymorphism?dandymcgee wrote:I always forget you can treat derived class objects as if they were their parent's type
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
Code: Select all
Game.Update()
{
for (int i = 0; i < gameObjects.Count; i++)
{
gameObjects[i].Update();
}
}
Code: Select all
for (int i = 0; i < players.Count; i++)
{
players[i].Update();
}
for (int i = 0; i < enemies.Count; i++)
{
enemies[i].Update();
}
for (int i = 0; i < buildings.Count; i++)
{
buildings[i].Update();
}
Falco Girgis wrote:It is imperative that I can broadcast my narcissistic commit strings to the Twitter! Tweet Tweet, bitches!
We had a thread a little while back discussing why using an actual iterator is faster than using the vector/list index.vargonian wrote: Let's say that at every frame, you iterate over all your objects in the game and update them (which is very common).
Code: Select all
for(vector<Object*>::iterator Iter = ObjectList.begin(); Iter != ObjectList.end(); ++Iter)
{
(*Iter)->OnUpdate(deltaTime);
}
I realized the moment I fell into the fissure that the book would not be destroyed as I had planned.