What is destructor in C++ with example?

A destructor is a member function that is invoked automatically when the object goes out of scope or is explicitly destroyed by a call to delete . A destructor has the same name as the class, preceded by a tilde ( ~ ). For example, the destructor for class String is declared: ~String() .3 Ağu 2021

Sizin İçin Seçtik  Does MIT consider edX courses?

Leave a Reply

Your email address will not be published. Required fields are marked *

What is destructor in C++ with example?

A destructor is a member function that is invoked automatically when the object goes out of scope or is explicitly destroyed by a call to delete . A destructor has the same name as the class, preceded by a tilde ( ~ ). For example, the destructor for class String is declared: ~String() .3 Ağu 2021

Sizin İçin Seçtik  Do inherited classes need constructors?

Leave a Reply

Your email address will not be published. Required fields are marked *