Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*==================================================================================================
- --------------------------------------------------------------------------------------------------
- [stackPhuke.cpp]
- Stack phuck + nuke: It's fun time!
- NOTE:
- You have more fun if you compile with GCC. Meanwhile, check out the exponential compile time.
- (c) Damion 'Phr0z3n.dev' Tapper, 2014.
- Email: [email protected]
- --------------------------------------------------------------------------------------------------
- ==================================================================================================*/
- #include <iostream>
- /*===============================================--=================================================
- THE CTemp CLASS
- --------------------------------------------------------------------------------------------------*/
- class CTemp
- {
- public:
- CTemp(){ std::cout << "CTemp constructor." << std::endl; }
- CTemp(CTemp *pct)
- {
- CTemp *pctemp(pct);
- std::cout << "CTemp overloaded constructor." << std::endl;
- } // "I am the architect."
- ~CTemp();
- };
- CTemp *pctemp;
- CTemp::~CTemp()
- {
- try
- {
- std::cout << "CTemp destructor exception thrown." << std::endl;
- throw(pctemp);
- }
- catch(CTemp *cte)
- {
- CTemp ctempe(cte);
- std::cout << "CTemp destructor exception caught." << std::endl;
- }
- }
- /*===============================================--=================================================
- THE main METHOD
- --------------------------------------------------------------------------------------------------*/
- int main(void)
- {
- /**
- *
- **/
- CTemp pct(new CTemp);
- pctemp = &pct;
- delete pctemp;
- //pctemp->~CTemp();
- //pct.~CTemp();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment