Suppose you have a pointer a and you want to access data member b of a class.View more random threads:
- importance of Object Oriented 2011
- what are Templates?
- The use of Function templates in C++ and C, java, php 2011
- what is ADT in simple words?
- required help in for read txt file in c++ and java
- Disadvantage of encapsulation
- char s1[] = "example"; char s2[20] = "another example"...
- c++ code 2011
- explain error handling in c++ 2011
- what is huffman encoding?
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.
Sponsored Links
So, you can say that (*a).b = a->b, that is, both have the same effect.
There are currently 1 users browsing this thread. (0 members and 1 guests)