Static but private variables in library

Hello, I am trying to to turn some of my working functions into a library. My functions use static varaiables. Normally I could just declare them public (I think) but I can't do this. These variables need to be the same name in each function (for repairability and maintenance if that makes any sense), but are used in many functions. Here is a visual example of what I mean

Library x

class a { private static int _y }

class b { private static int _y }

My question is can I call these variables static and they still will not interfere with each other? The reason they need to be static is the function is a sort of counter that is called to check of its progress occasionally and if it doesn't contain static variables it loses its place. It also far too different to use an actual Timer, so that's out of the question.

Thanks

Yes, you can call static variables in different classes by the same name and they won't interfere with each other. However, I advise caution. Using a static variable means that all instances of the class share the same variable. Is this really what you want? In particular, it may prevent a user of the library instantiating two or more separate instances of your library class.

There are 5 functions that exist in each class. Each one of those functions do not share the static variables inside their class. The variables are not static to share between functions, they are static to share between function calls. The function will return a 1 or 0 to be compared when the time is up. When the time is up a 1 is returned and then the times reset. The next time this function is called the timers are reset. The only problem I could see this causing is if the function is called in one spot it the main section and then called again in a different spot. That could lead to the second instance of calling the function to actual return a 1 when the first instance would be up. However, in the main section this "double calling" is not done. Correct me if i'm wrong but this is the only problem I would have to look out for. The other 4 functions that do not share variables with the first in the same class should be unaffected when they are instantiated.

Thanks for your reply by the way.

It sounds to me that you should be using instance variables (not static variables), and the user of your library should declare static instances of your class.