Respect my authoriteh 👮

Relecture_main
Alexis Drai 2 years ago
parent b6e4f145a7
commit b7167660ac

@ -3,4 +3,4 @@ project(cpp_stl)
set(CMAKE_CXX_STANDARD 17)
add_executable(cpp_stl main.cpp)
add_executable(cpp_stl main.cpp Personnage/Personnage.cpp Personnage/Personnage.h Personnage/Kenny.cpp Personnage/Kenny.h)

@ -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 <string>
#include <list>
#include "Personnage/Personnage.h"
#include "Personnage/Kenny.h"
using namespace std;
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;
}

Loading…
Cancel
Save