Subj : Can you mimic atexit() for class functions? To : borland.public.cpp.borlandcpp From : gary Date : Tue Oct 07 2003 11:54 pm just wondering if it is possible to have a member function in various (different) classes, but provide a single additional class that defines some kind of "AddCallback()" function that each object of the various other classes can call in order to add their own member function to a callback list so that the single additional class can invoke the list of added callbacks each in turn ? this is sort of like the way atexit() works in C, but in that case it is easy to just define every added callback as "void (*pfn)()", whereas in the C++ case, all the different classes would seem to necessarily have a different declaration that can't be cast to "void (*pfn)()" to way you can in C. any idea if this is possible at all, or am i just looking at it from the wrong direction (i.e., writing C++ while thinking C) ? for instance, would it be possible to do this if each of the different classes each inherited a member function from the single additional class so that each different class' callback function had the same type (e.g., "void (CallbackList::*MyCallback)()", if i did that right) ? hope this question is clear. it confused even me, and i asked it... .