Possible Duplicate:
What is the difference between new/delete and malloc/free?
I was confused when I create an object by using new operator in C++. There must be difference between malloc and new operator that would allow me to resize the memory block. If I want to allocate a memory I use malloc but what if I use a new operator?
İsn't it allocate a memory? Can you explain that when shoul I use malloc and when should I use new ?
X* ptr = new(1,2) X;
obj = (ObjID *)malloc( sizeof(ObjID) );
thanks so much.