class MyClass
{
public:
MyClass()
{
std::cout << "MyClass Constructor" << std::endl;
}
~MyClass()
{
std::cout << "MyClass Destructor" << std::endl;
}
};
int main()
{
MyClass* p = new MyClass();
}
What is the difference between calling p->~MyClass(); OR delete p;
Both call the destructor.
Aucun commentaire:
Enregistrer un commentaire