Any way to prevent dynamic allocation of a class?

后端 未结 3 723
醉酒成梦
醉酒成梦 2021-01-18 06:12

I\'m using a C++ base class and subclasses (let\'s call them A and B for the sake of clarity) in my embedded system.

It\'s time- and space-critical, so I really nee

3条回答
  •  囚心锁ツ
    2021-01-18 06:50

    class A
    {
    private:
        void *operator new(size_t);
        ...
    };
    

    The elipses are for the other overrides of operator new and the rest of the class.

提交回复
热议问题