Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 9671e07d03
Fetching contributors…

Cannot retrieve contributors at this time

21 lines (19 sloc) 0.744 kb
\begin{Exercise}[title={Pointers and reflection},difficulty=1]
\label{ex:pointers and reflection}
One of the last paragraphs in section ``\titleref{sec:introspection and reflection}''
on page \pageref{sec:introspection and reflection}, has
the following words:
The code on the right works OK and sets the member \var{Name}
to ``Albert Einstein''. Of course this only works when you call \func{Set()}
with a pointer argument.
Why is this the case?
When called with a non-pointer argument the variable is a copy (call-by-value). So you
are doing the reflection voodoo on a copy. And thus you are \emph{not}
changing the original value, but only this copy.
Jump to Line
Something went wrong with that request. Please try again.