fork download
  1. #include <iostream>
  2. using std::ostream;
  3.  
  4. namespace zv
  5. {
  6. class date
  7. {
  8. private:
  9. int day, month, year;
  10. public:
  11. date(int d, int m, int y) : day(d), month(m), year(y) {}
  12. friend ostream& operator<<(ostream& out, const zv::date &a);
  13. };
  14.  
  15. ostream& operator<<(ostream& out, const zv::date &a)
  16. {
  17. return out << a.day << '/' << a.month << '/' << a.year;
  18. }
  19. }
  20.  
  21. int main()
  22. {
  23. zv::date a(1,1,2000);
  24. std::cout << a;
  25. }
Success #stdin #stdout 0s 3340KB
stdin
Standard input is empty
stdout
1/1/2000