If you are reading this, you probably already know that:
means take the address of value and put it in valueAdress.
So the & operator gives back the address of something?!
Well, that is wrong. I't not always like that. There is one case when this is untrue.
In this case we are using a pointer to member and it does not make much sense to get the address of something that does not have an instance. In this case the & operator gives back an offset to the member in the class we are pointing to.
The offset (in the last line) called the member pointer is dereferenced to a member and then assigned normally.
No comments:
Post a Comment