fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. class Player
  5. {
  6. public: int hp;
  7. Player(int h): hp(h){};
  8. };
  9.  
  10. int main() {
  11. Player* heheszki[4];
  12. for(int i=0;i<4;++i)
  13. {
  14. heheszki[i] = new Player(i);
  15. }
  16. cout<<heheszki[0]->hp<<"\n";
  17. cout<<heheszki[1]->hp<<"\n";
  18. cout<<heheszki[2]->hp<<"\n";
  19. cout<<heheszki[3]->hp<<"\n";
  20.  
  21. return 0;
  22. }
Success #stdin #stdout 0s 3472KB
stdin
Standard input is empty
stdout
0
1
2
3