Tuesday 15 June 2010

c++ - Why do we need to use virtual ~A() = default; instead of virtual ~A() {} in C++11? -


In the stack overflow post , I have the comment:

In C +11 you really want to do virtual ~ A () = default; Otherwise, you will lose the alleged driver.

virtual ~ A () = what is default; For ? Virtual ~ A () {} ?

The comment is not correct.

both:

  virtual ~ a () = default;   

and

  virtual_a () {}   

user declared . And inhibit members of the inactive conduction if the destroyer user is declared.

[dcl.fct.def.default] / p4 User declared and User provided Special member:

A special member function is provided by the user if it has been declared by the user and clearly not declared in the previous announcement or has been removed. / P>

No comments:

Post a Comment