What is Copy Constructor?

Answer Posted / srikanth kanchari

Copy constructor is created by the compiler if you dont
Create, but it does shallow Copy of the Object so there is
a need to create a copy constructor by the Developer to
make deep copy of the object.

Normally it will be

Class A
{
A();
A(A&);// copy constructor
};

Is This Answer Correct ?    19 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Discuss the role of C++ shorthands.

558


What is class definition in c++ ?

639


Explain function prototypes in C++.

622


#include #include #include #include void insert(char *items, int count); int main(void) { char s[255]; printf("Enter a string:"); gets(s); insert(s, strlen(s)); printf("The sorted string is: %s.\n", s); getch(); return 0; } void insert(char *items, int count) { register int a, b; char t; for(a=1; a < count; ++a) { t = items[a]; for(b=a-1; (b >= 0) && (t < items[b]); b--) items[b+1] = items[b]; items[b+1] = t; } } design an algorithm for Insertion Sort

2177


Explain the advantages of using friend classes.

599






What is c++ manipulator?

562


How is c++ used in the real world?

581


Explain the difference between class and struct in c++?

596


List the advantages of inheritance.

648


Write a program to find the Factorial of a number

585


What is #include ctype h in c++?

670


How can you quickly find the number of elements stored in a static array?

648


Why do we use constructor?

608


Can abstract class have normal methods?

619


What are all predefined data types in c++?

569