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

Define virtual constructor.

0 Answers  


Does c++ have string data type?

0 Answers  


Differentiate between realloc() and free().

0 Answers  


What is name hiding in c++?

0 Answers  


What is an inclusion guard?

0 Answers  






How can you create a virtual copy constructor?

0 Answers  


What is "map" in STL?

2 Answers  


Explain "passing by value", "passing by pointer" and "passing by reference" ?

5 Answers  


Do class declarations end with a semicolon? Do class method definitions?

0 Answers  


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

0 Answers  


Can we make any program in c++ without using any header file and what is the shortest program in c++.

0 Answers   MCN Solutions,


What is rvalue?

0 Answers  


Categories