Public operator new, private operator delete: getting C2248 “can not access private member” when using new

前端 未结 5 798
自闭症患者
自闭症患者 2020-11-27 22:33

A class has overloaded operators new and delete. new is public, delete is private.

When constructing an instance

5条回答
  •  隐瞒了意图╮
    2020-11-27 23:23

    Check this. In one of the lower paragraphs it says that new requires delete to be accessable. Basically it says, you can only create objects on the heap, if you can also delete them again.

提交回复
热议问题