Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Re: Indirection operator and write access

7 views
Skip to first unread message

Victor Bazarov

unread,
Jun 3, 2012, 9:31:34 AM6/3/12
to
On 6/2/2012 1:22 PM, Paradigm wrote:
> Here is the scenario:
>
> There is a pointer variable 'x'.
>
> For what type of 'x' would the following show a write access on 'x'
>
> std::cout<<*x<<'\n'; //showing write access on x [what's its type?]
>
> I could not think of any possible situation apart from overloaded '*'
> operator having write operation inside the definition itself.

You can't overload the operator* for pointers. That's a built-in one.
Once you dereference *x, you get a reference to the object. The pointer
variable does not have any play in dealing with that, so it seems that
the write access to 'x' itself has nothing to do with '*x'.

V
--
I do not respond to top-posted replies, please don't ask
0 new messages