c++ - Scalar deleting destructor -


i have piece of code (from dll) looks this:

class {     public:         virtual ~a(); };  class b : public {     public:         ~b(); }  ~a() {     // #1 }  ~b() {     // #2 } 

when use delete an_instance_of_b scalar deleting destructor. workarounds?

don't delete instance of b. you're supposed use delete on pointers object allocated new:

b b; delete b;   //wrong  //.........  b* pb = new pb; delete pb;  //okay  //.........  b justthis; //best 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -