What is the difference between creating an object,
using 'new' and using 'malloc'?
Answer Posted / btech
new operator returns a pointer of the correct type and
malloc() returns a void*
New calls the object’s constructor and malloc does not.
Any object created with new must be freed using delete and
where as malloc() and free() allocates and deallocates
memory
new operator can be overloaded by a class, where as
malloc() can't be overloaded.
Is This Answer Correct ? | 9 Yes | 0 No |
Post New Answer View All Answers
What does I oop mean?
Is c++ an oop?
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
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 data encapsulation is in c++?
Why multiple inheritance is not possible?
If I is an integer variable, which is faster ++i or i++?
Is c or c++ more useful?
What is #include c++?
Write about c++ storage classes?
Discuss the role of C++ shorthands.
In C++ what is the meaning of data hiding?
What are c++ manipulators?
What is class and structure in c++?
What Is A Conversion Constructor C++ ?