On Mon, Mar 10, 2003 at 11:59:05PM +0000, Keith Whitwell wrote: > > > class TNL { > > > // A OpenGL function > > > virtual void Coord3f(GLfloat x, GLfloat y, GLfloat z) = 0; > > > > ^^^^^^^ > > pure virtual method. Depending on what you want to do with this, > > this will incur in a function call overhead, inline or not. > > Unless C++ can figure out at compile time *exactly* which class is being > invoked, I think... It's hard to know.
It can know it if it knows the type of the object, e.g. TNL tnl; tnl.Coord3f(x, y, z); or: HardwareTNL *tnl; /* or whatever you called this before */ tnl->Coord3f(x, y, z); but in: foo(TNL *tnl) { tnl->Coord3f(x, y, z); } the call definitely can't be inlined because the compiler doesn't know the "real" type of tnl. Here is where virtual enters the game. Do you really want to call TNL's Coord3f in foo or do you want to call whatever is appropiate for the type of the parameter? If the later, the member has to be virtual. Marcelo ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ Dri-devel mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/dri-devel