fork download
  1. #include <iostream>
  2. #include <iostream>
  3.  
  4. class EventDate
  5. {
  6. private:
  7. short m_day;
  8. short m_month;
  9. short m_year;
  10.  
  11. public:
  12. EventDate(short day, short month, short year)
  13. : m_day(day), m_month(month), m_year(year) {}
  14.  
  15. void print()
  16. {
  17. std::cout << m_day << "/" << m_month << "/" << m_year;
  18. }
  19. };
  20.  
  21. int main()
  22. {
  23. EventDate event { 18, 12, 2023 }; // Use short values for day, month, and year
  24. event.print(); // Calls the print method for the event object
  25.  
  26. return 0;
  27. }
  28.  
Success #stdin #stdout 0s 5284KB
stdin
Standard input is empty
stdout
18/12/2023