Is there a way to access a variable in a class without instantiating the class?

Hi,

I am trying to search for an example to understand if it is possible to access a variable in a class without instantiating the class.
Any help would be much appreciated.

PS: I think the variable needs to be declared static but I’m not sure.

Thanks,
Sruthi.

In reply to sk7799:

Creating an instance (object) of a class is exactly when they become available to access. Each class object you create has a corresponding set of class variables. Static class variables belong to the class type, not each object. You can access static class variables without every creating any class objects.

In reply to dave_59:

If there is no object handle, where do these static variables live Dave ?

In reply to deepthig92:

They live in the declarative scope where the class is defined. If the class is defined in a package, then the variable is in the package. If in a module, then it is with each instance of the module.