Objects and Classes
An object is a mixture of code and data that you control as a unit. An object can be a piece of a program, for example, a control or a window.
When you make a program in ViviFire, you constantly use objects. You can use objects supplied by ViviFire, for example, controls and data access objects. You can use objects supplied by other programmers. Also, you can make objects for your program only.
You can think of objects as building blocks for programs. They let you write a piece of code one time and use it again and again.
Objects and classes
TODO
To make an object from a class
SomeClass my_object
New SomeClass my_object
Multiple instances
TODO
Object members
TODO
Member access
To get access to a member of a class, you write, (1) the name of the object variable, (2) a period (.
), and (3) the name of the member.
The example that follows sets the property Text
of an object of type StatusBar
.
my_status.Text = "Ready"
Properties
You use property procedures when:
- The property must obey limits on values.
- The value of the property can change only for some conditions.
- Changes to the value cause a change that can be sensed, for example text shown by a control.
- Changes to the property cause other properties to change.
See Property Procedures for more information.
Methods
TODO
See Procedures for more information.
Events
TODO
See Events for more information.
Instance members and shared members
TODO
Access to a nonshared member of an object
Make sure that you made the object from its class and assigned it to an object variable.
TODO
In the statement that gets access to the member, write the object variable name, then a period (.
), and then the member name.
TODO
Access to a shared member of a class
You write the class name, then a period (.
), and then the member name.
You cannot get access to a shared member through a variable.
TODO
Differences between classes and library modules
TODO
Use classes again and again
Objects let you declare variables and procedures one time and then use them again and again. For example, if a control to select dates is necessary, you could make one for your program only. But you can be sure that this function will be necessary for other programs. If you make your control as a class, you can easily use it with other programs. But a class made by a different person could be much easier.
TODO
How objects are related
TODO
Parent–child relations
TODO
Container relations
TODO
Collections
TODO