11-05-2011, 05:23 PM
Suppose you have a pointer a and you want to access data member b of a class.
Now if you will write:
*a.b
it will not work as (.) is evaluated before (*)
But if you will write:
(*a).b
it will access b, because now (*a) will be evaluated first because of the brackets.
The alternate way is to use:
a->b
Now it is simple and there is not any confusion.
So, you can say that (*a).b = a->b, that is, both have the same effect.
Now if you will write:
*a.b
it will not work as (.) is evaluated before (*)
But if you will write:
(*a).b
it will access b, because now (*a) will be evaluated first because of the brackets.
The alternate way is to use:
a->b
Now it is simple and there is not any confusion.
So, you can say that (*a).b = a->b, that is, both have the same effect.
0300-9520262
Get solution in 24 hour |cpmputer & internet
mileys81:[SIZE="4"][SIZE="3"]....[/SIZE][/SIZE]
