Skip to content

Instantly share code, notes, and snippets.

@maksadbek
Created October 6, 2013 12:33
Show Gist options
  • Save maksadbek/6853520 to your computer and use it in GitHub Desktop.
Save maksadbek/6853520 to your computer and use it in GitHub Desktop.
#include <iostream>
using namespace std;
class Test{
private:
~Test(){
cout<<"destroying..."<<endl;
}
public:
Test(){
cout<<"Creating..."<<endl;
}
friend void destructorTest(Test *);
};
void destructorTest(Test *ptr)
{
delete ptr;
cout<<"Destroying object..."<<endl;
}
int main()
{
Test *ptr = new Test;
destructorTest(ptr);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment