I have a question about C++ pointer operators. What's the difference between these two operators, .* and -%26gt;*, and . and -%26gt;? I know what the dot does, but I'm not so sure about the rest of them, specifically the pointers-to-members operators. (I know they're names and Microsoft tries to explain them but it's a little confusing.) Help? Thanks.
I need some help with C++ pointer operators.?
okay. you said you know the dot operator, then, the -%26gt; operator works just the same. Except, the -%26gt; calls the member of the pointer objects. for eg, you have declared one instant of the class such as:
Student *mystudent;
where the mystudent object has become the pointer to the class Student.
Just because of this, whenever you want to access the Student class member, you need to use the -%26gt; instead of . operator, like in this line:
mystudent-%26gt;getStudent();
The same for ......-%26gt;*.......,
this really returns the pointer(i.e address) of the corresponding member being called, like in this case,
mystudent-%26gt;*getStudent();
will return the address of the getStudent value, which is stored in the system.
Reply:dude i really dont know. i only know about C
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment