C++ virtual function table memory cost

前端 未结 13 1782
抹茶落季
抹茶落季 2020-12-03 08:14

Consider:

class A
{
    public:
        virtual void update() = 0;
}

class B : public A
{
    public:
        void update() { /* stuff goes in here... */ }
         


        
13条回答
  •  无人及你
    2020-12-03 09:05

    You have two options.

    1) Don't worry about it.

    2) Don't use virtual functions. However, not using virtual functions can just move the size into your code, as your code gets more complex.

提交回复
热议问题