When copy constructor can be used?

Answer Posted / vikas sood

hi fellows..try this code
class A {
public:
A() { }
A(const A& rhs)
{
cout<<"inside copy constructor..";
}
};

int main()
{
std::vector<A> aVec(10);
}

The answer to this is another reason a copy constructor
will be called.

Is This Answer Correct ?    2 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

When does a name clash occur in c++?

717


What is #include iomanip?

550


How many ways can a variable be initialized into in C++?

603


Is c++ a float?

606


find the two largest values among the 6 numbers using control structures : do-while,for,if else,nestedif- else ,while. one or two of them.

2001






Give 10 points of differences between C & C++.

627


Can we use pointers in c++?

616


What are shallow and deep copy?

601


What are the four partitions in which c++ compiler divides the ram?

700


Write about all the implicit member functions of a class?

600


How a macro differs from a template?

637


Reverse the Linked List. Input: 1->2->3->4->5->NULL Output: 5->4->3->2->1->NULL

340


Explain stack unwinding.

640


What does 7/9*9 equal ? a) 1 b) 0.08642 c) 0

583


What are the vectors in c++?

581