salem c thank you, but I'm not getting the fact that why inside public, string isn't being detected or it is not taking string variables, but outside public i can declare strings.
#include <iostream>
#include <string>
usingnamespace std; // shouldn't use this in header files
class Player
{
public:
string player1;
};
int main()
{
Player p;
p.player1 = "bob";
cout << p.player1 << '\n';
}