2 ms·
> Java has scoped 'destruction' (called try-with-resources). This is nicer than manually writing `finally` blocks, but it's nowhere near as nice as RAII-style
by Rusky 9y ago
> Java has scoped 'destruction' (called try-with-resources).
This is nicer than manually writing `finally` blocks, but it's nowhere near as nice as RAII-style destructors, which you can't accidentally leave out.
- pjmlp 9y agoSure you can, you just need to allocate them on the heap and forget about calling delete on them or not properly handle exceptions. Not everyone is writing C++ as they should.