Topic: Featuritis: Pointers To Members


Author: john@bnrmtl.bnr.ca (John Hickin)
Date: 26 Jul 91 18:12:26 GMT
Raw View
It just occurred to me that pointers to members will be useful for List
classes:

 class List{ public:
  //etc:

  typedef void (Object::*PmfV) ();
  void apply( PmfV objectMemberFcnToApply );

  //etc
 };

Without pointers to members we can only apply global functions unless we
break the type system.

--
John Hickin      Bell-Northern Research, Montreal, Quebec
(514) 765-8888   bnrmtl!john@larry.mcrcim.mcgill.edu




Author: stevej@bnrmtl.bnr.ca (Steve Juneau)
Date: 26 Jul 91 18:29:47 GMT
Raw View
In article <1991Jul26.181226.19946@scrumpy@.bnr.ca>, john@bnrmtl.bnr.ca (John Hickin) writes:
|> It just occurred to me that pointers to members will be useful for List
|> classes:
|>
|>  class List{ public:
|>   //etc:
|>
|>   typedef void (Object::*PmfV) ();
|>   void apply( PmfV objectMemberFcnToApply );
|>
|>   //etc
|>  };
|>
|> Without pointers to members we can only apply global functions unless we
                                           ^^^^^^^^^^^^^^^^^^^^^^
|> break the type system.
|>

That's true, but the way apply() is defined the only methods you
can pass to it are methods which are defined for the class Object
only.

--
Steve Juneau                            Recherches Bell-Northern Ltee
                                        3, Place du Commerce
phone: (514) 765-8246                   Verdun, Quebec, Canada
fax:   (514) 876-3681                   H3E 1H6

email: bnrmtl!stevej@larry.mcrcim.mcgill.edu