Even though there are so many articles on how virtual functions are handled in c++, i could not clear one basic doubt. Is vptr variable of derived class overrided by base class variable. Is the ptr varible also name mangled?
Class Base
{
public:
virtual void test();
};
class Derived
{
public:
virtual void test();
};
If I call
Base b = new Derived();
b->test();
It transforms to
(*b->vptr[<index>])(b);
Where index points to vtable entry.
My doubt is whether is this vptr also name mangled ?
The C++ standard doesn’t even acknowledge the existence of a
vptrin polymorphic classes because it’s an implementation detail and therefore it isn’t even a requirement that compilers implement virtual functions in this way. So no,vptris not a reserved keyword (which is what I think you’re trying to ask).