@saurabh....if i look from the way that i need to return a referencei.e. i
mean object...i will ryt *this for this..........i knew this............but
i have read that reference is a const pointer ....so if i look from this
prespective then do i need to return pointer(this)..............
int * fun()//return pointer to int

then what does return by reference mean if i return ( *this)..then what
actually returns...........full object???or pointer to object...mix
questions ...plz clear me..

On Tue, Oct 9, 2012 at 11:26 PM, Saurabh Kumar <srbh.ku...@gmail.com> wrote:

> >> as we know reference is a const pointer
> That is Not quite true.
>
> >> our aim is ony to return pointer to circle
> No. our aim is to return a reference to circle.
>
> When you've to define a reference you do something like: *Circle &ref = c;
> *
> you *don't* do: *Circle &ref = &c;* Right ?
>
> Same is the case here, at the receiving end where the call was initiated a
> reference is waiting there to be initialized, so you pass the Object
> (*this) itself and NOT the pointer (this).
> [Also remember if you've a complex object, no copy constructors etc. are
> called when an object is sent for *reference receiving,* so no need of
> worries there.]
>
> References are not quite exactly same as pointers, they were introduced
> much later as a wrapper to pointers but there are some subtle differences
> between them when it comes to writing code, behaviorally, yes they are more
> or less the same.
>
> On 9 October 2012 22:54, SAMM <somnath.nit...@gmail.com> wrote:
>
>> This used for the following situation when   a=b=c=d  (Consider then as
>> the  objects of a particular class say X ).
>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to algogeeks@googlegroups.com.
>> To unsubscribe from this group, send email to
>> algogeeks+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/algogeeks?hl=en.
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Algorithm Geeks" group.
> To post to this group, send email to algogeeks@googlegroups.com.
> To unsubscribe from this group, send email to
> algogeeks+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/algogeeks?hl=en.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com.
To unsubscribe from this group, send email to 
algogeeks+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to