Re: different pointer types
On Feb 21, 2:35 pm, Richard Herring <junk@[127.0.0.1]> wrote:
In message <op.t6vjy61crttu86@debian>, David C=F4me
<davidc...@wanadoo.fr> writes
On Thu, 21 Feb 2008 13:25:34 +0100, thomas <FreshTho...@gmail.com> wrote:=
can anyone tell me the difference between "int class::*" and "int *"
for example:
class A{
private:
int a;
};
what's the difference between "int A::*" and "int *"?
"int A::*" a pointer to a member of A.
"Pointer to member" is a misleading name, since it's not
really a pointer in the usual sense at all, more like an
offset (but particularly if virtual inheritance is involved,
it's not as simple as that.)
In the case of pointers to member functions, its' even more
complicated.
I agree that another name ("selector", maybe) might be more
appropriate, but it does share at least one thing with standard
pointers: a null pointer constant will convert implicitly to it,
and the result of that conversion is guaranteed to compare
unequal to any valid pointer to member.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34