hi,
i have just started out with c++. unfortunately the material that i'm reading does not explain the difference between what it calls alias variables & variable references.
hope somebody knows.
I've explored somewhat myself, everything points to the fact that aliases are the same thing as references. To bad though, this is not very consistent. I haven't got his books, but i wonder what Bjarne Stroustrup calls them.
I have one of his books that i used as a "reference" no pun intended, but i believe he uses references. It is just one of those things that are not consitent with all programmers but
you must know they mean the same thing. Similarly in the way in java where reference, address (in memory), and pointer all pretty much mean the same thing.
After a little bit of a searching, I found that the alias refers to the new name (variable in the scope of the function) that passed variable takes on while in the function. In other words, just like someone has an alias they slip into and out of while doing certian things. I suppose it's meant to drive home that it's the same peice of memory not a fresh copy in the function's activation record... but personally, I still prefer "pass by reference" or "reference varible" to "creating an alias." Because I think of "creating an alias" as being creating a keyboard shortcut at the command prompt (shell's alias command -- very useful).
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.