0

hey guys.. am learning c++
just started.. am not able to implement member dereferencing operators.. i know there basic definations and rules but...its like.. a clear picture is still not coming to my mind..as in how to make use of them.. please explain with examples..

5
Contributors
7
Replies
8
Views
8 Years
Discussion Span
Last Post by ArkM
0

There is no such concept as "dereferencing and operator". Operators are like <, >, <=, /, +, etc. You probably mean dereferencing a pointer.

int n = 123;
int* p = &n;
*p = 0; // dereferencing a pointer
0

He perhaps, meant that he wants to customize the uranary * operator ( the dereferencing operator) for is custom class.

He mentions that he just started learning C++:

hey guys.. am learning c++
just started..

I think that's usually not one of the first topics you'll learn (if you're learning C++), but it could be he meant that though I find it strange he would :) ...

0

"implementing the dereferencing operator" means overloading it for your class.
I though agree, that the OP may not referring to operator overloading.
Anyways, in that case, the Dragon has already replied.

0

There is no such concept as "dereferencing and operator". Operators are like <, >, <=, /, +, etc. You probably mean dereferencing a pointer.

int n = 123;
int* p = &n;
*p = 0; // dereferencing a pointer

It's interesting that there is a page in the new C++ Standard Draft where operator*() named dereferencing operator. However as usually this operator called indirection operator in C++ Std docs.

0

okay i think i should clarify my query..
am writing down the definations from my source of learning-
operator function
::* To declare a pointer to a member of a class
.* To access a member using object name and a
pointer to that member
->* To access a member using a pointer to the object
and a pointer to that member


okay..now can u please give me some sample programs using above member dereferencing operators..i'll be highly obliged..
come on guys.. help me out!!

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.