C++ reference is implemented as a pointer internally.

Internally, a reference is generally implemented as pointer and the object syntax transformed into the indirection required of a pointer. [ P23, Inside the C++ object model]

But, logically, we can still take a reference as a new name to a block of memory. That means a variable can has more than one names.  Through the view of the implementation, there is only one real name and the others are all indirected pointer.
 
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章