What is the point of doing this:
class thing {
    
public:
    void setMarbles(int _marbles){marbles = _marbles;}
    void getMarbles(){return marbles;}
    
private:
    int marbles;
};
when you can just do this:
class thing {
    
public:
    int marbles;
};
I feel like this is a super common question, but I cant find an answer anywhere. My only theory is that if the order ov variables are changed in a new version of the class, programs that are using the old class will have the variables switched. Is this the correct reason?
 
     
     
    