jeudi 12 août 2021

How many vtable and vptr are created?

Yesterday I had interview in a multinational company they gave me the following code snippet and asked me how many vtable and vptr are created?

Scenaria 1:

class Base
{
    public:
        virtual void func1()
        {
        }
};

Output: ?

Scenaria 2:

class Derived : public Base
{
    public:
        virtual void func2()
        {
        }
};

Output: ?

Aucun commentaire:

Enregistrer un commentaire