Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


why the memory allocated with new cant be freed using free()

Answers were Sorted based on User's Feedback



why the memory allocated with new cant be freed using free()..

Answer / 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

why the memory allocated with new cant be freed using free()..

Answer / bharti

Because with new operator in C++ delete operator is used to
deallocate the memory. And with malloc() free() is used. S
it may not be supported by some of the compilers to free
memory with free() created by new.

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More OOPS Interview Questions

How do you achieve polymorphism?

0 Answers  


Difference between realloc() and free?

9 Answers   HP,


What is oops in simple words?

0 Answers  


write knight tour problem which is present in datastructure

0 Answers  


What is static modifier?

0 Answers  


What does sksksk mean in text slang?

0 Answers  


what are abstract classes and how they impliment , with example

2 Answers  


Which is not an object oriented programming language?

0 Answers  


How to handle exception in c++, For example in a functions i am assigning memory to some variables and also in next instructions in am dividing one variable also. If this functions generates a error while allocating memory to those variable and also while dividing the variable if i divide by zero then catch block how it will identify that this error has cone from perticular instruction

0 Answers  


program in c++ that can either 2 integers or 2 floating point numbers and output the smallest number

1 Answers   Anna University,


what is the difference between inter class and abstract class...?

0 Answers  


What do you mean by binding of data and functions?

3 Answers  


Categories