Programa C++
Enviado por gerg700 • 10 de Septiembre de 2013 • 245 Palabras (1 Páginas) • 279 Visitas
clase empleado
#ifndef EMPLEADO_H_INCLUDED
#define EMPLEADO_H_INCLUDED
#include <iostream>
using namespace std;
class Empleado: public Persona//hereda de la clase persona
{
double Sueldo;
public:
Empleado(double, char*, int, int);//se le pasan los parametros del clase herdedada
double getSueldo();//{return Sueldo;}
void mostrarEdad();
void mostrarDUI();
};
Empleado::Empleado(double s,char* n,int e,int d): Persona(n,e,d)
{
Sueldo = s;
}
double Empleado::getSueldo()
{
return Sueldo;
}
void Empleado::mostrarEdad()
{
cout << Persona::getEdad();
}
void Empleado::mostrarDUI()
{
cout <<Persona::getDUI();
}
#endif // EMPLEADO_H_INCLUDED
clase persona
#ifndef PERSONA_H_INCLUDED
#define PERSONA_H_INCLUDED
#include <cstring>
class Persona
{
private:
char* Nombre;
int Edad;
int DUI;
public:
Persona(char *, int, int);
char* getNombre();
protected:
int getEdad();
int getDUI();
};
Persona::Persona(char *n, int e, int d){
Nombre = new char[strlen(n)+1];//reserva memoria
...