Can you overload destructor for your class?

1 answer

Answer

1209399

2026-08-02 05:01

+ Follow

No. Classes can only have one destructor, whether you define one yourself or allow the compiler to generate one for you. The compiler-generated destructor is public by default, does not release any memory allocated to any class' member pointers, and is non-virtual, which are the three main reasons for defining your own.

ReportLike(0ShareFavorite

Copyright © 2026 eLLeNow.com All Rights Reserved.