ya_zay4eg

// 43_Deconstructors

Jun 26th, 2014
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.07 KB | None | 0 0
  1. // 43_Deconstructors
  2. #include "VeryBest.h"
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     VeryBest myObject;//constructor runs
  9.     cout<<"OMG what a pussy!!"<<endl;
  10.  
  11.     return 0;
  12. }//when you get here C++ automatically destroys all your object's (this case VeryBest)
  13. //destructor - the code that runs automatically (not explicitly ) upon the destruction of your object.
  14. //there is no deconstruction overloading
  15. //when your program finish running that's when your deconstruction gonna get called/
  16. //it's gonna called automatically
  17.  
  18. //------------------------------------------------------------------------------------
  19. #ifndef VERYBEST_H
  20. #define VERYBEST_H
  21.  
  22.  
  23. class VeryBest
  24. {
  25.     public:
  26.         VeryBest();
  27.         ~VeryBest();
  28. };
  29.  
  30. #endif // VERYBEST_H
  31.  
  32. //------------------------------------------------------------------------------------
  33. #include "VeryBest.h"
  34. #include <iostream>
  35. using namespace std;
  36. VeryBest::VeryBest()
  37. {
  38. cout<<"I'am the constructor"<<endl;
  39. }
  40. VeryBest::~VeryBest(){
  41. cout<<"Oh fuck, this is pussy destroyer!!!";
  42. }
Advertisement
Add Comment
Please, Sign In to add comment