why the memory allocated with new cant be freed using free()
Answer Posted / durgalakshmi
new keyword does two things.
1) allocate memory using new operator
2) invokes the constructor.
so the allocated memory using new should be freed only by
delete which frees the memory by calling the destructor.
But free will not do these things.
| Is This Answer Correct ? | 3 Yes | 0 No |
Post New Answer View All Answers
What is oops?what is its use in software engineering?
What is constructor in oop?
What are the data types in oop?
What are objects in oop?
c++ program to swap the objects of two different classes
What makes a language oop?
What is overriding in oop?
What is the important feature of inheritance?
What is and I oop mean?
Where is pseudocode used?
Write a program to reverse a string using recursive function?
What are constructors in oop?
Plese get me a perfect C++ program for railway/airway reservation with all details.
How to use CMutex, CSemaphore in VC++ MFC
What is difference between abstraction and encapsulation?