Virtual Pointer

前端 未结 5 1881
迷失自我
迷失自我 2021-02-07 16:04

What is virtual pointer? Hi, ALL, Today I had an telephone interview and got a question: \"What is virtual pointer?\" I stumbled on this one, so after it was finished, I tried G

5条回答
  •  不知归路
    2021-02-07 16:18

    There is no such thing as a "virtual pointer."

    There are a few things the interviewer might have meant:

    • A pointer to a polymorphic class
    • A pointer to the vtable of a polymorphic class (credit @Maxim)
    • A pointer within the vtable of a polymorphic class
    • A smart pointer object with an overridden operator->
    • A pointer to a virtual member function (credit @ Matthieu M)

    But as far as "virtual pointer" is concerned, there's no such thing.

提交回复
热议问题