Path: utzoo!utgpu!water!watmath!clyde!rutgers!gatech!mcnc!decvax!decwrl!pyramid!prls!philabs!pwa-b!mmintl!franka From: franka@mmintl.UUCP (Frank Adams) Newsgroups: comp.lang.c++ Subject: Re: C++ enhancements Message-ID: <2787@mmintl.UUCP> Date: 25 Mar 88 18:02:50 GMT References: <2781@mmintl.UUCP> <7757@apple.Apple.Com> Reply-To: franka@mmintl.UUCP (Frank Adams) Organization: Ashton-Tate Corporation, East Hartford Development Center Lines: 27 In article <7757@apple.Apple.Com> lsr@apple.UUCP (Larry Rosenstein) writes: >Another (unrelated) addition I would like to see is something like a delayed >method call. My idea would be to package up an object and a virtual >function name into an Invocation object. These objects could be passed >around and stored, and at some later time you could cause the function to be >called with the given object. (Suppose that the function takes no >parameters.) class deferred { public: object *receiver; void (* action)(object *); deferred(object *thing, void (* act)(object *)) { receiver = thing; action = act;} inline void do_it() {(*action)(receiver);} }; If the function is virtual, you may have to do something like: deferred button(it, &it->zoom); but I think this works. -- Frank Adams ihnp4!philabs!pwa-b!mmintl!franka Ashton-Tate 52 Oakland Ave North E. Hartford, CT 06108