Page 116 of 229 Start Back Next End ZBasic Language Reference 106 ZBasic Microcontrollers Seconds = Min(s, 59.999) End Sub Function GetHour() as Byte GetHour = hour End Function Function GetMinute() as Byte GetMinute = minute End Function Function GetSeconds() as Single GetSeconds = seconds End Function Private: Dim hour as Byte Dim minute as Byte Dim seconds as Single End Class Section labels may be used in any order and may appear multiple times. The order used in the example above is suggested but any suitable arrangement may be chosen. It is important to remember that private data members and methods are only visible to methods of the class. This is in contrast to the situation with structures where private members are visible to all procedures within the same module but not visible outside of the module in which the structure is defined. 4.10 Static Class Members So far, all of the methods and data members defined in the examples have been object-specific. That means that invoking a method or accessing a data member had to be realized via an object reference, e.g. t.SetTime(). Within the methods themselves, the methods and data members of the class can be accessed without an explicit object reference because the object reference is implicit. It is possible to define methods and data members that can be accessed without any object reference, explicit or implicit. To do so, simply add the Static keyword to the definitions as illustrated in the example below. Class MyTime Public: Sub _Create(ByVal h as Byte = 0, ByVal m as Byte = 0, _ ByVal s as Single = 0.0) Call SetTime(h, m, s) End Sub Sub SetTime(ByVal h as Byte = 0, ByVal m as Byte = 0, _ ByVal s as Single = 0.0) hour = Min(h, 23) minute = Min(m, 59) Seconds = Min(s, 59.999) End Sub Function GetHour() as Byte GetHour = hour End Function Function GetMinute() as Byte GetMinute = minute End Function