I'm trying to call the destructor of a class explicitly in Turbo C++:
A a;
a.~A();
But it's showing an error:
Member identifier expected.
Is there any way to explicitly call a destructor in Turbo C++?
From this link, it seems you actually can do it, the valid format is:
A a;
// a.~A(); // Wrong - Member identifier expected
a.A::~A(); // Valid
But I don't have a Turbo C++ compiler handy to test it, so you'll have to test it.
[Edit]
OP tested it, it works.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With