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 whitespace in C++.

0 Answers   HCL,


how is returning structurs from functions?Show an eg?

1 Answers   GE,


Why main function is special in c++?

0 Answers  


What are the general quetions are in DEna bank manager IT/System interviews?

0 Answers   Dena Bank, ICICI,


Which algorithm do you like the most? Why?

2 Answers   Google,






Which function cannot be overloaded c++?

0 Answers  


Explain what happens when a pointer is deleted twice?

0 Answers  


What are the advantages of c++?

0 Answers  


Where is atoi defined?

0 Answers  


What are the various arithmetic operators in c++?

0 Answers  


class Foo { const int x; protected: Foo(int f); ~Foo(); }; Foo f; Referring to the sample code above, why will the class declaration not compile? a) The variable x is const. b) The destructor is protected. c) The destructor is not public. d) The constructor is protected. e) There is no default constructor.

5 Answers   Quark,


What is the main purpose of c++?

0 Answers  


Categories