this is not a real pointer?

后端 未结 2 807
独厮守ぢ
独厮守ぢ 2021-01-19 21:38

I am reading something about virtual table. When it comes to pointer __vptr, it is stated that by the author

Unlike the *this

2条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-19 22:18

    Both pointers are real in the sense that they store an address of something else in memory. By "real" the author means "stored within the class", as opposed to this pointer, which is passed to member functions without being stored in the object itself. Essentially, the pointer to __vptr is part of the object, while this pointer is not.

提交回复
热议问题