When you construct an object, you allocate memory. For example, T foo;
allocates memory sufficient for type T.
In your mental model, associate the block of memory where foo
sits with T
.
The essense to be safe is:
If a block of memory has type T
, you may only use:
- [
const
/volatile
]T*
pointer - a [
unsigned
]char*
pointer