I am learning C++ and trying to store objects in a universal buffer. (bObj acting as buffer in above snippet). aObj does have memory access but constructor call doesn't happen which Is what i m trying to achieve.
It sounds like you need to read up on placement new
. See What uses are there for "placement new"? and What is "placement new" and why would I use it? for some background and examples of use.
Bear in mind that using placement new
correctly requires care. It is very easy to get it wrong and end up with undefined behaviour.
In particular, you'll need to rethink how you allocate the buffer.