Advertisement
Guest User

Untitled

a guest
Apr 22nd, 2019
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.55 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. struct C
  5. {
  6.     int c;
  7.     C(int i) : c{i} { if((i==10)and(j!=1))
  8.         {
  9.         std::cout << "C::C(" << i << ")" << std::endl;
  10.         j=1;
  11.         }
  12.         else if(i!=10)
  13.             std::cout << "C::C(" << i << ")" << std::endl;
  14.            
  15.                     }
  16.     static C c0;
  17.     static int j;
  18.     static void f(C c);
  19. };
  20.  
  21. int C::j=0;
  22. C c1 = 0;                          
  23. C C::c0 = 1;
  24.  
  25. void C::f(C c)
  26. {
  27.     C c2 = c.c;
  28. }
  29.  
  30. int main()
  31. {
  32.     C::f(10);
  33.     C::f(20);
  34.     return 0;
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement