What is Copy Constructor?




Answer Posted / naveen kumar

The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously.

Is This Answer Correct ?    1 Yes 0 No






Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the difference between a "copy constructor" and an "assignment operator" in C++?

26


Explain function prototypes in C++.

19


Why can’t you call invariants() as the first line of your constructor?

1


What do you mean by persistent and non persistent objects?

15


Mention the purpose of istream class?

8






What are vtable and vptr?

8


What is a stack? How it can be implemented?

1


Why use of template is better than a base class?

3


Is it possible to get the source code back from binary file?

9


On throwing an exception by the animal constructor in p = new animalq, can memory leak occur?

9


If we want that any wildcard characters in the command line arguments should be appropriately expanded, are we required to make any special provision? If yes, which?

13


What is protected inheritance?

2


How can we access protected and private members of a class?

10


If P is the population on the first day of the year, B is the birth rate, and D is the death rate, the estimated population at the end of the year is given by the formula: The population growth rate is given by the formula: B – D Write a program that prompts the user to enter the starting population, birth and death rates, and n, the number of years. The program should then calculate and print the estimated population after n years. Your program must have at least the following functions: 1. growthRate: This function takes its parameters the birth and death rates, and it returns the population growth rate. 2. estimatedPopulation: This function takes its parameters the current population, population growth rate, and n, the number of years. It returns the estimated population after n years Your program should not accept a negative birth rate, negative death rate, or a population less than 2. please answer my question ....

1086


Write a function that swaps the values of two integers, using int* as the argument type?

9