c++ - Why the virtual destructor in derived class is empty? -
i have 1 question, see in codes, virtual destructor in derived class empty, why need since nothing? used phone call destructor in base of operations class , without it, destructor cannot called? or notation tell code reader destructor virtual makes code much easier read? thanks!
why need since nothing?
if base of operations class has virtual destructor, don't have to define empty 1 in derived class. reason set there remind other readers of code there virtual destructor class.
is used phone call destructor in base of operations class , without it, destructor cannot called?
an empty destructor participate in destructor chaining in same way non-empty or inherited destructor does. long base of operations class has virtual destructor, providing empty override not alter behavior.
c++
No comments:
Post a Comment