C++ Virtual Destructors -


Prototype classes I place the dishes in this way:

  Virtual ~ MyClass ();  

When the classroom is finalized in a library, I saw that I can not add 'virtual', is it normal, and whether virtual is kept in mind or should I Do something wrong?

For example; When I try to do this, I get a compiler error:

  Virtual MyClass :: ~ MyClass () {}  

Instead of doing this My question is: virtual

Is there no need to include the distructor to write a destructor, still behaves as a virtual destructor (because it is virtual as a prototype)?

"post-text" itemprop = "text">

virtual is used only as part of the member function declaration within class definition

If the member is defined outside the definition of the function class, then the virtual keyword is not placed there.


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -