delete vs dealloc

C

cwc5w

Is "delete" equivalent to "dealloc"?
is it more efficent ?
can "delete" be used on variable of any type?

Thanks
 
D

Daniel T.

Is "delete" equivalent to "dealloc"?

By "dealloc" do you mean free? If so, then no they are not equivalent,
'delete' also calls the objects destructor. You should always "delete"
something you "new" and "free" something you "malloc".
is it more efficent ?

It is neither more or less efficient.
can "delete" be used on variable of any type?

It can be used on any pointer type as long as the object pointed to was
created with "new".
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top