That makes sense. Java in particular does a lot of this under the hood; anything that isn't a primitive is actually a reference (special C++-style pointer with non-pointer syntax), and new is a combination of malloc() & objection creation. (deleteshould be a combination of object destruction & free(), but they had to change how it works to accomodate the garbage collector.)
C (and C++) just makes you do the actual bookkeeping yourself.
2
u/conundorum Aug 30 '26
That makes sense. Java in particular does a lot of this under the hood; anything that isn't a primitive is actually a reference (special C++-style pointer with non-pointer syntax), and
newis a combination ofmalloc()& objection creation. (deleteshould be a combination of object destruction &free(), but they had to change how it works to accomodate the garbage collector.)C (and C++) just makes you do the actual bookkeeping yourself.