M
Matthew Del Buono
AFAIK...
Order of precedence of operators:
post ++
post --
..
..
..
->
..
pre ++
..
..
..
* (indirection)
sizeof
new
delete
(type) (typecast)
..*
->*
..
..
|=
,
So what exactly is the point of .* and ->* (other than giving maybe a neater
or other way of writing things)? Aren't these the same? (Assume class A is
defined with a pointer to an integer "bar"):
A foo;
A* pFoo = new A;
foo.bar = 4;
*foo.bar = 4;
pFoo->*bar = 4;
*pFoo->bar = 4;
As far as I can tell, all of these assignments perform the same task. Now,
I'm sure it is much easier to read pFoo->*bar than *pFoo->bar (it appears in
the latter example that pFoo is trying to be dereferenced). Is that the only
reason for the operator?
-- Matt
..
Order of precedence of operators:
post ++
post --
..
..
..
->
..
pre ++
..
..
..
* (indirection)
sizeof
new
delete
(type) (typecast)
..*
->*
..
..
|=
,
So what exactly is the point of .* and ->* (other than giving maybe a neater
or other way of writing things)? Aren't these the same? (Assume class A is
defined with a pointer to an integer "bar"):
A foo;
A* pFoo = new A;
foo.bar = 4;
*foo.bar = 4;
pFoo->*bar = 4;
*pFoo->bar = 4;
As far as I can tell, all of these assignments perform the same task. Now,
I'm sure it is much easier to read pFoo->*bar than *pFoo->bar (it appears in
the latter example that pFoo is trying to be dereferenced). Is that the only
reason for the operator?
-- Matt
..