fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Foo {
  5. public:
  6. int getA() const { return a;}
  7. int getB() const { return b;}
  8. private:
  9. int a = 1;
  10. int b = 2;
  11. };
  12.  
  13. void print(const Foo& f = {}) {
  14. std::cout << f.getA() << ", " << f.getB() << std::endl;
  15. }
  16.  
  17. void pprint(const Foo& f = Foo()) {
  18. std::cout << f.getA() << ", " << f.getB() << std::endl;
  19. }
  20.  
  21. int main() {
  22. // your code goes here
  23. print();
  24. pprint();
  25.  
  26. return 0;
  27. }
Success #stdin #stdout 0s 5320KB
stdin
Standard input is empty
stdout
1, 2
1, 2