Advertisement
tomasaccini

Untitled

Jul 20th, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.99 KB | None | 0 0
  1. #include <string>
  2. #include <iostream>
  3.  
  4. class FechaYHora {
  5. private:
  6.     std::string fecha_y_hora;
  7. public:
  8.     // Constructor default
  9.     FechaYHora();
  10.  
  11.     // Constructor con string de inicialización
  12.     FechaYHora(const std::string& fecha_hora);
  13.  
  14.     // Constructor de copia
  15.     FechaYHora(const FechaYHora& other);
  16.  
  17.     // Operador <
  18.     bool operator < (const FechaYHora& other) const;
  19.  
  20.     // Operador ==
  21.     bool operator == (const FechaYHora& other) const;
  22.  
  23.     // Operador =
  24.     FechaYHora& operator = (const FechaYHora& other);
  25.  
  26.     operator int() const;
  27.  
  28.     friend std::ostream& operator << (std::ostream& o, const FechaYHora& fyh);
  29.     friend std::istream& operator >> (std::istream& i, FechaYHora& fyh);
  30. };
  31.  
  32. std::ostream& operator << (std::ostream& o, const FechaYHora& fyh) {
  33.     o << fyh.fecha_y_hora;
  34.     return o;
  35. }
  36.  
  37. std::istream& operator >> (std::istream& i, FechaYHora& fyh) {
  38.     i >> fyh.fecha_y_hora;
  39.     return i;
  40. }
  41.  
  42. int main() {
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement