Answer Posted / amar
Copy constructors is used in following cases.
1) When object is passed by values to a fucntion
2) when function returns object by value
3) When new object is created from exixting object using
overlaoded = operator.
If user has not defined its own copy constructor, compiler
synthesised constructor would be called which will do
shallow copy. So if you have pointer in your class then only
the pointer value is copied and not the contents which
pointer points to.
| Is This Answer Correct ? | 12 Yes | 5 No |
Post New Answer View All Answers
Assume an array of structure is in order by studentID field of the record, where student IDs go from 101 to 500. Write the most efficient pseudocode algorithm you can to find the record with a specific studentID if every single student ID from 101 to 500 is used and the array has 400 elements. Write the most efficient pseudocode algorithm you can to find a record with a studentID near the end of the IDs, say in the range from 450 to 500, if not every single student ID in the range of 101 to 500 is used and the array size is only 300
What is the error in the code below and how should it be corrected?
Write some differences between an external iterator and an internal iterator? Describe the advantage of an external iterator.
What is while loops?
How do I write a c++ program?
What is the use of volatile variable?
What doescout<<(0==0) print out a) 0 b) 1 c) Compiler error: Lvalue required
Define anonymous class.
What do you understand by pure virtual function? Write about its use?
Which is the best c++ software?
What is encapsulation in c++?
What flag means?
What is a storage class?
Can I have a reference as a data member of a class? If yes, then how do I initialise it?
Can user-defined object be declared as static data member of another class?