Yes, absolutely, it will work.
HOWEVER, note that garbage collection is not deterministic, that is, it is not reported when it will work.
Therefore, any destructors that you must call will not be called immediately when you do not specify a pointer.
If object "A" is or contains links to file objects, database objects, connection objects, etc., you will need to use reference counting to ensure that they are immediately released.
Otherwise use GC; it is much less painful.
source
share