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|
What are the advantages of using const reference arguments in a function?
What is constructor in C++?
What do nonglobal variables default to a) auto b) register c) static
What are c++ stream classes?
What is c++ hash?
Which sort does c++ use?
What is the function of I/O library in C++ ?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
How is modularity introduced in C++?
Is it possible to pass an object of the same class in place of object reference to the copy constructor?
Write is a binary search tree? Write an algo and tell complexity?
explain the reference variable in c++?
How do you find out if a linked-list has an end? (I.e. The list is not a cycle)
What are multiple inheritances (virtual inheritance)? What are its advantages and disadvantages?
Write a note about the virtual member function?