What is 'Copy Constructor' and when it is called?
A copy constructor is called when an object is passed by value. Copy constructor itself is a function. So if we pass an argument by value in a copy constructor, a call to copy constructor would be made to call copy constructor which becomes a non-terminating chain of calls.
| Is This Answer Correct ? | 0 Yes | 0 No |
class Foo { public: Foo(int i) { } }; class Bar : virtual Foo { public: Bar() { } }; Bar b; Referring to the above code, when the object 'b' is defined, a compiler error will occur. What action fixes the compiler error? a) Adding a virtual destructor to the class Bar b) Adding a constructor to Bar which takes an int parameter c) Adding "Foo()" to the Bar constructor d) Adding a copy constructor to the class Foo e) Adding "Foo(0)" to the Bar::Bar initializer list
What is general format for a prototype?
What is function overriding in c++?
Is python better than c++?
What is auto type c++?
What are the weaknesses of C++?
What is array give example?
What are built-in functions? What is the syntax for the definition?
Enter n no. of element and delete value from desire position
What are advantages and disadvantages of Design patterns?
What is an accessor in c++?
What is pair in c++?