Please help me with following questions
(Multiple choice)
No Points if all choices are not ticked
Code:
**** Which of the following code fragments would trigger execution of the copy constructor of MyClass?
1. MyClass X; MyClass Y(X);
2. MyClass X; MyClass Y; X=Y;
3 MyClass X; MyClass Y=X;
4 MyClass fn1()
{ static MyClass X;
return X;
};
const MyClass & Y=fn1();
5 int fn1(MyClass Y)
{ return 1;
};
int i; MyClass Z;
i=fn1(Z);
*** Which of the following is true about default COPY constructor?
(Multiple CHoice )
1 takes no arguments
2 exists for any class
3 performs a shallow copy
4 will be executed when one object is assigned to another
5 is compiler generated