I'm trying to make a class called LoopingInt. It stores two integers, one being the maximum value of the integer, and the other being a stored integer. When the integer falls below 0 or above the maximum value, it "loops" back around. So if you add 3 to a LoopingInt with a value of 4, and the max value is 6, the internally stored integer in the class will be 7, but asking for the integer externally will return 0.
What I want to do is make it so I can work with LoopingInts as if they were integers. I can already assign LoopingInts to int objects (ie int x = myLoopingInt), but I can't assign an int to a LoopingInt because I can't figure out how to pass back a LoopingInt object with the right maximum value. I need the maximum value from the left-hand value, but I don't know how to get it.
WraparoundIntor something similar, as the notion of integer overflow causing the value to wraparound is familiar to many programmers.