SHARE
TWEET

Untitled

a guest Sep 15th, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /******************************************************************************
  2.  
  3.                               Online C++ Compiler.
  4.                Code, Compile, Run and Debug C++ program online.
  5. Write your code in this editor and press "Run" button to compile and execute it.
  6.  
  7. *******************************************************************************/
  8.  
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. /*int main()
  14. {
  15.     cout<<"Hello World";
  16.  
  17.     return 0;
  18. }*/
  19.  
  20. class A {
  21. public:
  22.     virtual int fun(){
  23.         cout << "A"; return 0;
  24.     }
  25.     int fun1(){
  26.         return fun();
  27.     }
  28.     ~A() {
  29.         fun();
  30.     }
  31. };
  32. class B: public A {
  33. public:
  34.     int fun()   {
  35.         cout << "B"; retunr 0;
  36.     }
  37.     int fun2(){
  38.         retunr fun();
  39.     }
  40. };
  41. char abecadlo[]= "przeintelektualizowany";
  42. class Y {
  43. public:
  44.     static int nn;
  45.     Y() {
  46.         cout << abecadlo [nn%20] << "~";
  47.     }
  48.     Y(int nn) {
  49.         Y::nn+=nn;
  50.     }
  51.     virtual `Y()  {
  52.         nn--;
  53.     }
  54. };
  55. Class X : public Y {
  56.     int n;
  57.     X *p;
  58.     Y q;
  59. public:
  60.     X(int nn): n(nn),p(0),q(nn) {
  61.         if(n%2)
  62.             p= new X(n-1);
  63.         cout << abecadlo[(n+nn)%10];
  64.     }
  65.     ~X() {
  66.         cout << nn;
  67.         if(p) delete p;
  68.     }
  69. };
  70. int Y::nn = 107416;
  71. int main()  {
  72.     Y* x = new X(5);
  73.     delete x;
  74.     B* b = new B;
  75.     b->fun1();
  76.     b->fun2();
  77.     delete b;
  78.     return 0;
  79. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top