ayuda practica1, creacion Makefile

This commit is contained in:
Pablo
2025-11-03 09:56:12 +01:00
parent 72fc476d11
commit 140ab49ea1
6 changed files with 282 additions and 49 deletions

31
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, 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(char *nom);
void setFecha(Fecha f);
bool operator==(Cliente c) const; // if (c1 ===c2)
};
ostream& operator<<(ostream &s, const Cliente &c); //funcion no amiga de la clase
#endif // CLIENTE_H

View File

@@ -1,5 +1,30 @@
#define Fecha_H
#include <iostream>
using namespace std;
#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
};
Fecha operator+(const int &i, const Fecha &f); //const por seguridad y & por velocidad
#endif // FECHA_H