[comp.lang.c++] pointers to overloaded member functions

asc@concurrent.co.uk (Andy Chittenden) (10/06/89)

I'm having difficulty with pointers to overloaded member functions.
Can anybody help?

The example below won't compile because I have an overloaded function.
However, as I have defined two different function pointers with
different parameters (f1 and f2 in my example) I would have thought that
C++ would select the correct functions on the two lines flagged as
errors below (afterall, when these functions are called directly C++
knows which one to call).

By the way, I'm using v1.2 of cfront.

// begin example

class Object {
  public:
    Object();
    void set_ChangeDate();
    void set_ChangeDate(const long);
};

typedef void (Object::*f1)();
typedef void (Object::*f2)(const long);

f1 fred = &Object::set_ChangeDate;	// C++ errors this
f2 joe = &Object::set_ChangeDate;	// and this

Thanks in anticipation, Andy Chittenden

----------------------------------------------------------------------
             ___________
            / _________/_   |   DOMAIN:     asc@concurrent.co.uk
           /_/________/ /   |   UUCP:       ...!uunet!ukc!concurrent!asc
  Concurrent/__________/    |   Royal Mail: 227 Bath Road
Computer Corporation        |               Slough SL1 4AX, England