Explain the difference between 'operator new' and the 'new'
operator?



Explain the difference between 'operator new' and the 'new' operator?..

Answer / richa

The term "operator new" is used incase when u are
overloading the global "new" operator.We can overload ne
operator just as any other operators i.e +,-,*,=etc.

The term "new operator" is used in case of dynamic
allocation of memory.When a variable is allocated memory
dynamically the new operator is used.
Eg:
int *p=new int;
//here p is pointer to integer.So in order to allocate
memory for it we have used the new operator.

Is This Answer Correct ?    15 Yes 0 No

Post New Answer

More C++ General Interview Questions

what is COPY CONSTRUCTOR and what is it used for?

0 Answers  


What does flush do?

0 Answers  


What are proxy objects?

2 Answers  


What is the purpose of decltype?

1 Answers  


What is the difference between the indirection operator and the address of oper-ator?

0 Answers  


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.

1 Answers  


Which function cannot be overloaded c++?

0 Answers  


What are iterators in c++?

0 Answers  


What is an undefined reference/unresolved external symbol error and how do I fix it?

0 Answers  


What is slicing?

1 Answers  


Is structure can be inherited?

5 Answers   HP, ST Micro,


When is dynamic checking necessary?

0 Answers  


Categories