2 ms·
This is not accurate. C++ has statically enforced private variables that cannot be modified by outside functions without fairly painful workarounds and castin
by rlp 9y ago
This is not accurate. C++ has statically enforced private variables that cannot be modified by outside functions without fairly painful workarounds and castings. But, if you want to say that the ability to do those castings would disqualify any compile-time guarantees, well, OCaml has an equivalent escape hatch. Module Obj contains a bunch of functions to manually manipulate any object fields and cast arbitrarily using the "magic" function.