[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
Class Functions
Declaring a class with the CREATE CLASS command causes a Clipper
function to be created. This function has the same name as the class and
is called a class function. Calling a class function returns the
class object for that class. The class function is most often used
when creating new objects (see next section). Class functions can also be
used to access class variables and class methods. Here are some examples
of different ways to use class functions:
oCust := Customer():new( 5, 10, 15, 70 )
? Window():nWinCount
Window():closeAll()
The first line creates a new object of class Customer by sending the
new() message to the Customer class. The second line accesses a class
variable called nWinCount in the Window class. The third line sends
the closeAll() message to the Window class. In all of these cases, a
class function is called to obtain a reference to a class object.
Terminology Note
For most purposes, the terms class and class object are
interchangeable. The class object is the class. For example, we said above
"The third line sends the closeAll() message to the Window class". We
could have added the word object onto the end of that sentence, but it
would be redundant. There is no way to send a message to a class other
than via a class object.
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson