[Solved] How fixed function access to the class data member?

[ad_1]

You defined setNumber const, Which means this function will not change any member of the class. Just remove const from function implementation.

class ho1
{
    int number;
public:
    ho1();
    void setNumber(int x)
    {
        number = x;
    };

};

[ad_2]

solved How fixed function access to the class data member?