Created
October 6, 2013 12:33
-
-
Save maksadbek/6853520 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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