Psst.. new poll here.
[email protected] web/email now available. Want one? Go here.
Cannot use outlook/hotmail/live here to register as they blocking our mail servers. #microsoftdeez
Obey the Epel!
Paste
Pasted as C++ by registered user raphael ( 1 year ago )
//Auteur Raphael De Oliveira
#include <iostream>
#include <string>
#include "nomfille.h"
using namespace std;
int main()
{
cout<<"Instanciation de la classe fille :"<<endl;
NomFille obj(15,"Diane","Nom de famille", 50);
cout<<obj.toString()<<endl;
return 0;
}
//--------------------------------------------------------------------------------------------------------------------
#ifndef NOMMERE_H
#define NOMMERE_H
#include <string>
using namespace std;
class NomMere
{
public:
int age;
string prenom;
string nom;
NomMere(int,string,string);
string toString();
};
#endif // NOMMERE_H
//--------------------------------------------------------------------------------------------------------------------
#ifndef NOMFILLE_H
#define NOMFILLE_H
#include "nommere.h"
#include <string>
using namespace std;
class NomFille : public NomMere
{
public:
NomFille(int , string , string , int);
int depot_bancaire;
};
#endif // NOMFILLE_H
//--------------------------------------------------------------------------------------------------------------------
#include "nommere.h"
#include <string>
#include <iostream>
using namespace std;
NomMere::NomMere(int a, string p, string n)
{
cout<<"Je suis dans le constructeur de la classe mere"<<endl;
this->age=a;
this->nom=n;
this->prenom=p;
}
string NomMere::toString(){
string result="";
result += nom +" "+prenom+" ";
return result;
}
//--------------------------------------------------------------------------------------------------------------------
#include "nomfille.h"
#include <iostream>
#include <string>
using namespace std;
NomFille::NomFille(int a, string p, string n, int argent) : NomMere(a,p,n)
{
cout<<"Je suis dans le constructeur de la classe fille"<<endl;
this->depot_bancaire=argent;
}
Revise this Paste