|  | Home · Examples

# Object Ownership

In Java, we have the garbage collector watching over us, and unsuring that objects are deleted when they are no longer in use. In C++, you have to carefully make sure to delete the objects yourself - though, in Qt, most deletion is handled automatically.

When you have both C++ and Java objects living at the same time and cooperating, this can often get you into trouble. The main problem is where objects should be deleted.

We have three scenarios: