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

What are the two different types of polymorphism?

0 Answers  


What is abstraction encapsulation?

0 Answers  


what is difference between c++ language and java language

5 Answers  


Write pseudo code for push in a stack?

2 Answers   emc2,


What is constructor overloading in oop?

0 Answers  


What is the different between Applet and Application?

2 Answers  


why reinterpret cast is considered dangerous?

0 Answers   TCS,


What is Method overloading?

5 Answers  


what is data hiding.

3 Answers   Wipro,


which is platform independent device used in computers

2 Answers  


What does oop mean in snapchat?

0 Answers  


What is polymorphism what is it for and how is it used?

0 Answers  


Categories