parent
b6e4f145a7
commit
b7167660ac
@ -0,0 +1,13 @@
|
|||||||
|
//
|
||||||
|
// Created by draia on 27/01/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include "Kenny.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void Kenny::parler(const string &message) const
|
||||||
|
{
|
||||||
|
cout << "MMmmmhhmmmm" << endl;
|
||||||
|
}
|
@ -0,0 +1,18 @@
|
|||||||
|
//
|
||||||
|
// Created by draia on 27/01/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CPP_STL_KENNY_H
|
||||||
|
#define CPP_STL_KENNY_H
|
||||||
|
|
||||||
|
|
||||||
|
#include "Personnage.h"
|
||||||
|
|
||||||
|
class Kenny : public Personnage
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
void parler(const std::string &message) const override;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CPP_STL_KENNY_H
|
@ -0,0 +1,12 @@
|
|||||||
|
//
|
||||||
|
// Created by draia on 27/01/23.
|
||||||
|
//
|
||||||
|
#include <iostream>
|
||||||
|
#include "Personnage.h"
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
void Personnage::parler(const string &message) const
|
||||||
|
{
|
||||||
|
cout << message << endl;
|
||||||
|
}
|
@ -0,0 +1,20 @@
|
|||||||
|
//
|
||||||
|
// Created by draia on 27/01/23.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef CPP_STL_PERSONNAGE_H
|
||||||
|
#define CPP_STL_PERSONNAGE_H
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
|
||||||
|
class Personnage
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
std::string name;
|
||||||
|
std::string pv;
|
||||||
|
public:
|
||||||
|
virtual void parler(const std::string &message) const;
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
#endif //CPP_STL_PERSONNAGE_H
|
@ -1,7 +1,21 @@
|
|||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#include <list>
|
||||||
|
#include "Personnage/Personnage.h"
|
||||||
|
#include "Personnage/Kenny.h"
|
||||||
|
|
||||||
|
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
int main()
|
int main()
|
||||||
{
|
{
|
||||||
std::cout << "Hello, World!" << std::endl;
|
|
||||||
|
list<Personnage *> anime = {new Personnage(), new Kenny(), new Kenny()};
|
||||||
|
|
||||||
|
for (Personnage *character: anime)
|
||||||
|
{
|
||||||
|
character->parler("Hey dude.");
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in new issue