HI All,
Someone asked me the following question and i am not able to get an answer for this.
In c++ how will you restrict
1)object creation in heap
2)object creation in stack
Can anyoine throw some light into this
Raghuram
Ruskalym (see above) already answered your question: if you don't want users
to be able to create objects on the heap, overload the new operator such that
it throws an error (or make it a private operator so that the user can't access it).
If you don't want objects on the stack you could make all constructors private
and add a 'factory method' that builds objects on the heap for the user.
kind regards,
Jos