d Now the opposite question in general when is it better to

d) Now the opposite question: in general, when is it better to use a pointer over a reference? Give an example of a programming scenario where it is certainly better to use a pointer.

Solution

The situation when it is better to use a pointer over a reference when there is chances of re-setting of data time to time or re-setting of states or where one can use NULL or transfer ownership.

Example :

A pointer helps in transferring owner-ship semantics.This is especially useful in multi-threading environment if the parameter-state is used to execute in a separate thread and you do not usually poll till the thread is exited

d) Now the opposite question: in general, when is it better to use a pointer over a reference? Give an example of a programming scenario where it is certainly b

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site