fork download
  1. #include <iostream>
  2.  
  3. class Test {
  4. public:
  5. Test() {};
  6. Test(int V):N(V) {};
  7.  
  8.  
  9. static void F0() {
  10. //std::cout << this->N << std::endl;// not have this.
  11. }
  12.  
  13. static void F1(Test& T) {
  14. T.N = 1;
  15. }
  16.  
  17. friend std::ostream& operator <<(std::ostream&os ,Test& T) {
  18. os << T.N;
  19. return os;
  20. }
  21.  
  22. protected:
  23. int N;
  24. };
  25.  
  26.  
  27. int main() {
  28. Test T(10);
  29.  
  30. T.F1(T);
  31.  
  32. std::cout << T << std::endl;
  33. return 0;
  34. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
1