What is an appropriate way of removing my_object as shown below?

Advertisement

my_class *my_object = new my_class();

  • delete(my_object);
  • free(my_object);
  • The garbage collector will destroy the object eventually.
  • Exiting the scope will destroy the object.
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Leave a Comment


Share via
Join our list

Subscribe to our mailing list and get interesting stuff and updates to your email inbox.

Thank you for subscribing.

Something went wrong.

Send this to a friend