Guest User

Untitled

a guest
Sep 22nd, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. #include <iostream>
  2. #include <list>
  3. #include <string>
  4. class Entity
  5. {public:
  6. std::string name = "Entity";
  7. virtual void update()
  8. {
  9. std::cout << "Metod Entity" << 'n';
  10. }
  11. };
  12.  
  13. class MovingPlatform:public Entity
  14. {
  15. public:
  16. void update()
  17. {
  18. std::cout << "Metod MovingPlatform"<<'n';
  19. }
  20. };
  21.  
  22. int main()
  23. {
  24. std::list <Entity> layers;
  25. Entity a;
  26. MovingPlatform b; b.name = "MovingPlatform";
  27. layers.emplace_back(a); layers.emplace_back(b);
  28.  
  29. for (auto it = layers.begin(); it != layers.end(); ++it)
  30. {
  31. std::cout << it->name << ": "; it->update();
  32. }
  33.  
  34. system("pause");
  35. }
  36.  
  37. Entity: Metod Entity
  38. MovingPlatform: Metod Entity
Add Comment
Please, Sign In to add comment