Advertisement
Gosunov

static govno

Oct 17th, 2022
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.38 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. class compute {
  5. private:
  6. static int a;
  7. public:
  8. static int get();
  9. static int get(int x);
  10. };
  11.  
  12. int compute::a{};
  13.  
  14. int compute::get() {
  15. return a;
  16. }
  17.  
  18. int compute::get(int x) {
  19. return a = x;
  20. }
  21.  
  22. int main() {
  23. cout << compute::get(3*4) << '\n';
  24. cout << compute::get() << '\n';
  25.  
  26. return 0;
  27. }
  28.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement