first consider a case..
if u write

book b1=b2 ;

for the above statement copy constructor is invoked..

just take the (b) option

 Book ( Book k)
{

}


which mean in main function u might be using something like

book  ob1;
book ob2( ob1);  //  that means u passing ob1 to copy constructor and it wud
be treated as
                        //     book k = ob1 ;

so for this  book k = ob1  ,, again the copy constructor is invoked ...
 this process is recursive and does not come to an end..

so thats why (b)  option is incorrect.

so u r allowed to have only reference in the constructor argument list..

am i clear?


On Tue, Aug 30, 2011 at 10:02 PM, tech coder <[email protected]>wrote:

> ++rahul
>
> see a constructor cant recieve an srgument of the same class type(by
> value), although it can recieve a reference of same class type, because the
> process become recursiv eand go infinite till stack overflow
>
>
> On Tue, Aug 30, 2011 at 9:28 AM, rahul sharma <[email protected]>wrote:
>
>> a.  default constructor
>> c. copy
>> d. parametrized.....
>>
>> in b it should recieve reference
>>
>>
>>
>> On Aug 30, 9:24 pm, Anuj kumar <[email protected]> wrote:
>> > Q)Given a class named Book, which of the following is not a valid
>> > constructor?
>> > (A) Book ( ) { }
>> >  (B) Book ( Book b) { }
>> > (C) Book ( Book &b) { }
>> >  (D) Book (char* author, char* title) { }
>> > Ans:B
>> >
>> > how plz give reason..
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Algorithm Geeks" group.
>> To post to this group, send email to [email protected].
>> To unsubscribe from this group, send email to
>> [email protected].
>> 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 [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> 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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.

Reply via email to