terminado parte1

This commit is contained in:
Pablo
2025-11-09 22:12:40 +01:00
parent d90429a4d9
commit 44826a2687
7 changed files with 321 additions and 0 deletions

31
parte1/include/Cliente.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef CLIENTE_H
#define CLIENTE_H
#include <iostream> //cin, cout
#include "Fecha.h"
using namespace std;
//SI FALTA ALGUN METODO O FUNCION A<>ADIRLO...
class Cliente {
long int dni;
char *nombre;
Fecha fechaAlta;
public:
Cliente(long int d, const char *nom, Fecha f);
virtual ~Cliente();
Cliente& operator=(const Cliente& c);
long int getDni() const { return this->dni; }
const char* getNombre() const { return nombre; } //VIP devolver un puntero constante para evitar que desde el main() se puede modificar el nombre
Fecha getFecha() const { return fechaAlta; }
void setNombre(const char *nom);
void setFecha(Fecha f);
bool operator==(const Cliente& c) const; // if (c1 ===c2)
};
ostream& operator<<(ostream &s, const Cliente &c); //funcion no amiga de la clase
#endif // CLIENTE_H

31
parte1/include/Fecha.h Normal file
View File

@@ -0,0 +1,31 @@
#ifndef FECHA_H
#define FECHA_H
#include <iostream> //cin, cout
using namespace std;
//SI FALTA ALGUN METODO O FUNCION A<>ADIRLO...
class Fecha {
int dia;
int mes, anio;
public:
Fecha(const int &dia, const int &m, const int &anio);
//virtual ~Fecha(); //NO HACE FALTA
//Fecha(const Fecha &f); //NO HACE FALTA: EL QUE GENERA EL COMPILADOR FUNCIONA BIEN YA QUE NO HAY PUNTEROS
int getDia() const { return dia; }
int getMes() const { return this->mes; }
int getAnio() const { return this->anio; }
void setFecha(const int &dia, const int &mes, const int &a);
void ver() const;
bool bisiesto() const;
Fecha operator++(); //++f
Fecha operator++(int i); //f++
Fecha operator+(const int &i) const; //f+5
friend Fecha operator+(const int &i, const Fecha &f); //const por seguridad y & por velocidad
friend ostream& operator<<(ostream& os, const Fecha& f);
};
Fecha operator+(const int &i, const Fecha &f); //const por seguridad y & por velocidad
#endif // FECHA_H