fork download
  1. #include <iostream>
  2.  
  3. class foo
  4. {
  5. private:
  6. struct problem
  7. {
  8. double array[5]; //Pretend its already initiated with the values 0-4.
  9. };
  10.  
  11. public:
  12. problem bar;
  13. void changebar(double input);
  14. };
  15.  
  16. void foo::changebar(double input)
  17. {
  18. bar.array[0] = input;
  19. }
  20.  
  21. int main()
  22. {
  23. foo f;
  24.  
  25. f.changebar(10);
  26. std::cout<<f.bar.array[0]<<"\n";
  27.  
  28. f.changebar(13);
  29. std::cout<<f.bar.array[0];
  30. }
Success #stdin #stdout 0s 3296KB
stdin
Standard input is empty
stdout
10
13