Path: utzoo!attcan!uunet!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!usc!apple!metaphor!dattatri From: dattatri@metaphor.Metaphor.COM (Dattatri) Newsgroups: comp.lang.c++ Subject: C++ Syntax Query Keywords: Pointer to Member Functions Message-ID: <1743@metaphor.Metaphor.COM> Date: 5 Nov 90 21:24:51 GMT Organization: Metaphor Computer Systems, Mountain View, CA Lines: 36 Since ANSI-C allows the following: int (*funcp)(); /* more code and initialization */ funcp(); /* (*funcp)(); is the old K&R style */ and C++ also allows this syntax, I feel it is odd not to allow the same generalization for pointer to member functions. See code below. class Pointer { public: int Integer; Pointer(int a=0) { Integer = a; } void display() { cout << Integer << '\n' ; } }; main() { void (Pointer::*ptf) (); ptf = &Pointer::display; Pointer alpha = 57; Pointer *beta = new Pointer(48); (alpha.*ptf)(); // Why not alpha.ptf() beta->ptf(); // this is also not allowed (beta->*ptf)(); // this is the language rule } The only logical argument would be: The call to a member function through a pointer to a member function should be explicit in the syntax such that a call through a pointer to a function and a call through a pointer to a *member* function appear different. Would anyone like to comment. I will post a summary if enough responses are received. Kayshav -- dattatri@metaphor.com