Why cant I create a class at the APP level?

I am going to create a timer event that updates variables at the server level so I was going to create a class under APP but Xojo wont let me. I thought that the APP level was the only place that is common to all sessions and the server itself.

You create a property at the App level that stores an instance of your class.

Of course, I havent got my head around class being able to be stored in something else. Thanks.

It’s not the class being stored there… It’s an instance of the class

Thanks for pointing that out, I am still struggling with the “instance of the class” bit, its like a variable that exists multiple times which is an odd thing for me :wink:

Think of the class as a template for, say, clothing. You design the template once, then use it to create multiple copies of, say, a sweater. But each copy (instance) has it’s own properties like color.

It’s a rough analogy to be sure, but perhaps enough to help you along in the right direction.

Just to throw another analogy out there, in case it helps it to stick, you could have a class called Car. That’s the blueprint. It says that Cars have certain properties (color, size, whatever). In OOP, this is called “state”. Cars also do stuff, they don’t just sit there. In OOP, the stuff they do is called their “behavior”. So, we have state and behavior.

So take your class/blueprint, and let’s make some of these. Each car you make from the blueprint is called an “instance”. So although you make one Car class, you might make 1000 instances from it. But here’s the important bit - the values of the properties are unique to each instance. Each car has the same properties but might have different values for each properties. Each instance is its own individual object, working independently of the other instances.

There’s much more of course. Once you get OOP, you might wonder how you made certain applications without it!