Modifiers

The following table shows the modifiers supported in Ginjo language.

Modifier Description
public All code that can access a file or class can access its public elements.
private Private elements are accessible only from within their declaration context, including from within any contained types (such as a nested class.)
protected Protected elements act as private elements that are also accessible from a derived class.
static A static variable or event is stored in memory only once, no matter how many class instances are created. All instances access the same storage location. If one instance changes the variable's value, then all instances access the updated value. Similarly, a static function or property holds only one set of local variables.
readonly Specifies that a variable or property can be read but not written. You can assign a value to a readonly variable only in its declaration or in the constructor of a class in which it is defined. Note that if the data type of the readonly variable is a reference type, such as an array or a class instance, its members can be changed even though the variable itself is readonly.
override A child class redefines a base class function using the override modifier. Regardless of how a child object is referenced (using either a base class or a child class reference) it is the child function that is called.
shadow If the child class function shadows the base class function, then a child object accessed via a base class reference will use that base class function, despite being a child object. The child function definition is only used if the child object is accessed using a matching child reference.

Default access modifiers

If an access modifier is not explicitly declared, the following access modifiers apply:

Declaration Default access level
var/constprivate
enum/structpublic
classpublic
functionpublic
propertypublic

The following table shows the access modifiers supported in Ginjo language and their equivalents in other languages.

Modifier Visual C++ C# VB.NET
public public public Public
private private private Private
protected protected protected Protected
static static static Shared
readonly const readonly Readonly
override override override Overrides
shadow - new Shadows