3 ms·
> For example, if we have a const Car, we can reach into it to grab a (non-const) Engine through which we can modify things. Isn't that already deep within und
by fivea 5y ago
> For example, if we have a const Car, we can reach into it to grab a (non-const) Engine through which we can modify things.
Isn't that already deep within undefined behavior territory?
That hardly is an adequate example, given that it spells an eggregious fault, the kind that's covered by any intro to C++ course with clear indications that it's nonsense.
- flqn 5y agoGetting a non-const reference out of a const object isn't undefined behaviour.