Original Post
Hi, all I need to write a class who offers a general function so that once the function is called, some function of another class will be called eventually. I plan to use such a template class template struct Port { typedef int (T::*FuncPointer)(const S*); FuncPointer functionPointer; T* classPointer; Port(T* classPtr, FuncPointer funcPtr) { classPointer = classPtr; functionPointer = funcPtr; } int Write(const S* data) { return (classPointer->*functionPointer)(data); } }; my question is, will this work in general? I tried it on two classes, and it worked. however, back to my vc2003 project (which is much more complicate), if failed. functionPointer's offset at constructor is 4 (from class pointer), but it somehow changed to 8 when Write gets called. plus, it never gets correct offset in vc2003's watch window. anyone has a clue? I will try to see whether I can replicate this problem on a simple project. thanks! baum