Shall we use 'free' to free memory assigned by new, What are
the further consequences??
Answer Posted / krishnarao panchadi
Syntactically we can use "free" in place of "delete". But
semantically it is senseless as it wont call the destructor.
Note that, deallocating is not the only purpose of
using "delete". The destructor should also be called if you
call the constructor(while creating the object).
Failing to call "delete" may lead to system crash.
Using "free" wont call the desturctor.
Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
What is runtime errors c++?
Describe the setting up of my member functions to avoid overriding by the derived class?
What is a storage class used in c++?
What jobs can you get with a c++ certification?
What is a multimap c++?
What are c++ storage classes?
What is the benefit of learning c++?
Name the debugging methods that are used to solve problems?
Describe the syntax of single inheritance in C++?
What is a multiset c++?
What is null pointer and void pointer and what is their use?
What is difference between array and vector in c++?
How many types of classes are there in c++?
What are vectors used for in c++?
What are its advantages and disadvantages of multiple inheritances (virtual inheritance)?