fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4.  
  5.  
  6. struct foo;
  7.  
  8.  
  9.  
  10. template <typename T>
  11. struct bar {
  12. static int get_mem() {return T::mem;}
  13. };
  14.  
  15.  
  16.  
  17. template <typename T>
  18. struct baz {
  19. int foo() {return T::mem;}
  20. };
  21.  
  22.  
  23.  
  24. int main() {
  25. // your code goes here
  26.  
  27. bar<foo>::get_mem();
  28. baz<foo> x;
  29. x.foo();
  30.  
  31. return 0;
  32. }
  33.  
  34. struct foo {
  35. static int mem;
  36. };
  37.  
  38. int foo::mem = 0;
  39.  
  40. int main2() {
  41. baz<foo> x;
  42. }
Success #stdin #stdout 0.01s 5272KB
stdin
Standard input is empty
stdout
Standard output is empty