function pointers + virtual

Started by
2 comments, last by BiTwhise 19 years, 5 months ago
if a class created a pointer to one of it's virtual fuctions, will it still go to the inheriting class's definition of that function?
Advertisement
You can't create normal function pointers to class member functions, only 'pointers to member function'. To answer your question; yes they will call the implementation in the derived class.
only if the object calling it is infact a derived class type. AFAIK the function call should act "just as it should"
[size=2]aliak.net
pointers to virtual functions store the offset into the vtable rather than the pointer to the actual function, and thus works as described above.

go here, for a in depth description of function pointers and a fast delegate implementation

This topic is closed to new replies.

Advertisement