I have a simple c++ class, intHolder, that only holds an int. It can also add to that int, which works, or add itself to another int contained in a different intHolder, which does not work. This is nothing like what I've encountered in Java. What's going on?
class intHolder{
private:
    int i;
public:
    intHolder(int myInt){i = myInt;}
    void addToInt(int inc){ i = i + inc;}
    void printInt(){cout << i << endl;}
    void addToOtherInt(intHolder other){other.addToInt(i);}
};
Main Method
int main () {
    intHolder ih1(1);
    ih1.printInt();//Should be 1, is 1
    ih1.addToInt(3);
    ih1.printInt();//Should be 4, is 4
    intHolder ih2(2);
    ih2.printInt();//Should be 2, is 2
    ih1.addToOtherInt(ih2);
    ih1.printInt();//Should be 4, is 4
    ih2.printInt();//Should be 6, is 2
};
 
     
     
    