C++ Institute CPA-21-02 Question Answer
What happens when you attempt to compile and run the following code?
#include
#include
using namespace std;
class First
{
string *s;
public:
First() { s = new string("Text");}
~First() { delete s;}
void Print(){ cout<<*s;}
};
int main()
{
First FirstObject;
FirstObject.Print();
FirstObject.~First();
}