void doSomething(int &*hi);
will not work. You cannot point to links. However, this:
void doSomething(int *&hi);
This is a link to a pointer. This is useful because now you can pass this pointer to a function to point to other types of Human.
If you look at this code, it points “hi” to “someVar”. But, since the original pointer passed to this function, nothing will change, since the pointer itself is passed by value.
void doSomething(int *hi) { hi = &someVar; }
So you do it
void doSomething(int *&hi) { hi = &someVar; }
So the original pointer passed to the function also changes.
If you understand “pointers to pointers,” then just imagine that, unless something is a link, it can be considered as “not a pointer”.
Aaron source share