Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <list>
- #include <string>
- class Entity
- {public:
- std::string name = "Entity";
- virtual void update()
- {
- std::cout << "Metod Entity" << 'n';
- }
- };
- class MovingPlatform:public Entity
- {
- public:
- void update()
- {
- std::cout << "Metod MovingPlatform"<<'n';
- }
- };
- int main()
- {
- std::list <Entity> layers;
- Entity a;
- MovingPlatform b; b.name = "MovingPlatform";
- layers.emplace_back(a); layers.emplace_back(b);
- for (auto it = layers.begin(); it != layers.end(); ++it)
- {
- std::cout << it->name << ": "; it->update();
- }
- system("pause");
- }
- Entity: Metod Entity
- MovingPlatform: Metod Entity
Add Comment
Please, Sign In to add comment