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
explain sub-type and sub class? atleast u have differ it into 4 points?
INSTANCE FIELDS DECLARED private ARE ACCESSIBLE BY THE METHODS ONLY.CAN WE CHANGE THE private FIELD OF AN OBJECT IN A METHOD OF SOME OTHER OBJECT OF THE SAME CLASS?
What is pointer in oop?
write knight tour problem which is present in datastructure
What does oop mean in snapchat?
What is multilevel inheritance in oop?
What is the purpose of enum?
Is abstract thinking intelligence?
Why do pointers exist?
What are the important components of cohesion?
What is protected in oop?
They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?
What is the real life example of polymorphism?
Why oops is important?
program for insertion ,deletion,sorting in double link list