fork download
  1. #include <iostream>
  2.  
  3. class A{
  4. int _x, _y;
  5. public:
  6. A(int x = 1, int y = 2) : _x(x), _y(y){}
  7.  
  8. int x() const{
  9. return _x;
  10. }
  11. int y() const{
  12. return _y;
  13. }
  14. };
  15.  
  16. int main() {
  17. A a, b(3,4);
  18. std::cout << "a: " << a.x() << " " << a.y() << std::endl;
  19. std::cout << "b: " << b.x() << " " << b.y() << std::endl;
  20. }
  21.  
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
a: 1 2
b: 3 4