Unsure of best way to recall a variable in a class

Hello All,

So I am still fairly new to programming and I am unsure of the best way to go about my this particular problem.

I have created a class within which there is a function. I will be calling this function many times. Each time I call it I want it to compare the previous input variables against the new ones.

I can create a private variable within the class but I don't need it to be available to all functions and this option feels a little clunky.

I considered using static variables, however i want the variables to be independant for each object. Is there any variables whose values will be preserved between multiple callings of a function, like static variables, but will have a differend value between different instances of the class, unlike static variables?

Any thoughts? What is the normal neat way of doing something like this?

Cheers,
David

Just use the private variable route. Any other way will be much clunkier. After all, a private class variable is there to represent per-instance variable which is exactly what you have.

It doesn't matter that only one function will be using it. There's no style expectation of members having to be referenced in multiple functions.