Attention: iDevGames forum has a new home at http://www.idevgames.com/forums.
Please update your bookmarks and linkage.
This forum has been locked and will be available for archival purposes only.
iDevGames - Mac, iPhone, iPad & iPod Game Developers Forum  


Programming Languages & Scripting dim3 : BlitzMax : Java : REALbasic : Lua : PyGame : Ruby : Unity3D : Python

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old
  (#1)
LongJumper
 
Posts: n/a
Member function pointer - 2005.10.31, 12:10 AM

Excuse my bad memory, but I forgot the syntax.

I have a class that has this definition in it...
Code:
class WorldObject
{
...
void (WorldObject::*draw)();
void drawCube();
};
When I initialize an instance of a WorldObject, I assign drawCube to draw.
Code:
draw = &WorldObject:drawCube;
When I want to draw, I call:
Code:
WorldObject * wo = &(worldObjects[i]);
((WorldObject*)wo->*draw)();
I get a syntax error, saying that it is of unknown type when I try and call the draw function. What gives?
   
 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump



Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.
vBulletin Skin developed by: vBStyles.com
DevServe Network: iDevApps | uDevGames | iDevGames