Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Participant
- {
- public:
- virtual void tipareste() = 0;
- bool eVoluntar();
- virtual ~Participant() { }
- };
- class Personal:public Participant
- {
- private:
- std::string nume;
- public:
- Personal(std::string nume) :nume{ nume } {}
- void tipareste() override
- {
- std::cout << nume;
- }
- };
- class Administrator :public Personal
- {
- public:
- Administrator(std::string nume) :Personal{ nume } {}
- void tipareste() override
- {
- Personal::tipareste();
- std::cout << "\nAdministrator";
- }
- };
- class Director : public Personal
- {
- public:
- Director(std::string nume) :Personal{ nume } {}
- void tipareste() override
- {
- Personal::tipareste();
- std::cout << "\nDirector";
- }
- };
- class Angajat :public Participant
- {
- private:
- Participant* ala;
- public:
- Angajat(Participant* ala):ala{ala}{}
- void tipareste() override
- {
- ala->tipareste();
- std::cout << "\nangajat";
- }
- bool eVoluntar()
- {
- return false;
- }
- };
- class ONG
- {
- private:
- std::vector<Participant*> cativa;
- public:
- void add(Participant* par)
- {
- cativa.pb(par);
- }
- std::vector<Participant*> getAll(std::string parametru)
- {
- std::vector<Participant*> aia;
- std::for_each(cativa.begin(), cativa.end(), [&aia,¶metru](Participant* ptr)
- {
- if (parametru == "angajat")
- {
- if (dynamic_cast<Angajat*>(ptr))
- aia.pb(ptr);
- }
- else
- if (!dynamic_cast<Angajat*>(ptr))
- aia.pb(ptr);
- });
- return aia;
- }
- };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement