[cross-posted]
Hi
If I have a pointer to one of my member functions, and the pointer is also a
member, in the same class, should 'this->' not be used implicitly in the
class scope to call the pointed function ?
Something like this:
class MbxAddress
{
protected:
void LocateAnyMbx()
{
}
void LocateUserMbx()
{
}
public:
void (MbxAddress::*L ocateMbx)();
MbxAddress(bool fManagers = true)
{
if (fManagers)
LocateMbx = &MbxAddress::Lo cateAnyMbx;
else
LocateMbx = &MbxAddress::Lo cateUserMbx;
LocateMbx();
}
};
Here the last call 'LocateMbx()' should work without explicitly writing
(this->*LocateMbx)( );
because 'this->' is implicit in class scope and
dereferencing the function pointer to call the referred function is also
implicit
anyway.
Of course in total there should be two uses of 'this->' here:
- one for the pointer itself since it is a member
- one for the refered function since it must be applied on an object to be
called
I think it would be natural for both uses to be implicit here.
Please, anyone wants to comment on this ?
Timothy Madden
Romania
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.m oderated. First time posters: Do this! ]
[ comp.std.c++ is moderated. To submit articles, try just posting with ]
[ your news-reader. If that fails, use mailto:std-c++@ncar.ucar.e du ]
[ --- Please see the FAQ before posting. --- ]
[ FAQ: http://www.jamesd.demon.co.uk/csc/faq.html ]
Comment