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
What are the features of oop?
What is this pointer in oop?
Question: Write a program that prints a paycheck. Ask the program user for the name of the employee, the hourly rate, and the number of hours worked. If the number of hours exceeds 40, the employee is paid “time and a half”, that is, 150 percent of the hourly rate on the hours exceeding 40. Be sure to use stepwi se refine ment and break your solution into several functions. Use the int_name function to print the dollar amount of the check.
What is class and object with example?
Please send ford technologies placement paper 2 my mail id
i got a backdoor offer in process global,Bangalore..Can i work with it?
If a=5, b=6, c=7, b+=a%c*2. What is the final value of b?
What is the difference between inheritance and polymorphism?
what is the drawback of classical methods in oops?
what type of question are asked in thoughtworks pair programming round ?
write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory
What is encapsulation process?
How is class defined?
What are constructors in oop?
What are the three parts of a simple empty class?