[Gambas-user] Static Classes and Modules

John Leake jleake at ...3375...
Sat Sep 20 10:59:03 CEST 2014


Hi All,
Could someone please clarify the characteristics of a static class.

My understanding of Static Classes from other languages is:

They cannot be created or more precisely no more than one instance of
the class can exist. This means that if a process alters the state of
the class then that changed state is seen by all other processes that
hold a reference to that class.

In Ruby for example, the same behaviour is achieved through Class
methods and Class variables ie they act on the class itself and not on
instances of that class.  Here multiple instances of a class have their
own state but if any one instance of that class changes the state of a
class variable then all instances of that class will see that change.

>From the docs;
"In Gambas, a static class is also named a module.

A static class cannot be instantiated: it would create an object with no
dynamic variable, which is useless."

So could someone tell me if a class without any dynamic variable ie a
static class, can or cannot be created ?




More information about the User mailing list