I am having an issue with overloading the assignment operator. I am getting a "terminator called recursively" error in the console.
I am relatively new to data structures and I'm having trouble debugging this issue.
Here is the class declaration:
class Player
{
public:
    Player(const unsigned int x_, const unsigned int y_, const char i_);
    Player(const Player& p_);
    ~Player();
    unsigned int getX() const;
    unsigned int getY() const;
    char getI() const;
    void updatePosition(int newX, int newY);
    Player& operator=(const Player& p_);
private:
    struct Position{
        unsigned int x;
        unsigned int y;
    };
    Position* pos;
    char i;
};
And here is the implementation of the operator= function:
Player& Player::operator=(const Player& p_)
{
    delete pos;
    pos = nullptr;
    pos = new Position();
    pos->x = p_.getX();
    pos->y = p_.getY();
    i = p_.getI();
    return *this;
}
 
    