fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class foo
  5. {
  6. public:
  7. int bar=5; //вот так
  8.  
  9. foo();
  10. };
  11.  
  12. // Где- то cpp
  13. foo::foo():bar(10)
  14. {
  15. }
  16.  
  17.  
  18. int main()
  19. {
  20. foo f;
  21. std::cout << f.bar << std::endl; // 10
  22. }
Success #stdin #stdout 0s 3468KB
stdin
Standard input is empty
stdout
10