Skip to main content
gamedev.net
🔒 Locked

POLYMORPH!

Started by MetaKnight 4 replies 350+ views
Original Post
MetaKnight
MetaKnight
This is my first time worknig with it but im trying to make it that a second of land can build all the object on it. ALl the objects have inherited "gameobject" and the land has pointers to gameobjects but it doesnt work, here''s a stripped down version of what i have: class gameobject { virtual void draw() { } }; class person : public gameobject { virtual void draw() { drawingstuffhere(); } } class landtile { gameobject *objectz; void draw() { objectz->draw(); } }; void main() { landtile land; person me; land.objectz = &me land.draw(); }
acraig
acraig
Need more info besides "it doesnt work". Are you using the right specifications for class members? ( ie public/private/protected. ) If things are private not even the children classes can access them.

-------
Andrew
PlaneShift - A MMORPG in development.
ph33r
ph33r
Here is a good post that you should consider reading



Clicky


[edited by - ph33r on April 23, 2003 9:16:34 PM]
cowsarenotevil
cowsarenotevil
quote:
Original post by ph33r
Here is a good post that you should consider reading

Clicky

[edited by - ph33r on April 23, 2003 6:36:02 PM]



WOW, you crashed the forums...


-~-The Cow of Darkness-~-
-~-The Cow of Darkness-~-
cowsarenotevil
cowsarenotevil
quote:
Original post by ph33r
Here is a good post that you should consider reading


[edited by - ph33r on April 23, 2003 6:36:02 PM]



WOW, you crashed the forums...


-~-The Cow of Darkness-~-
-~-The Cow of Darkness-~-
evil sausage
evil sausage
quote:
Original post by ph33r




Clicky

EDIT: Can a moderator fix this link? It's skrewing up the forums..




You could fix it yourself...

    
<a href = "http://www.gamedev.net/community/forums/topic.asp?topic_id=152257">Clicky</a>







[edited by - evil sausage on April 23, 2003 9:04:47 PM]
And so, the evil religion thread stole the wonderful "What the Heck?" thread's throne. Truly a sad day for gamedev.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.