In BBj 6.0 and higher, the CLASS verb marks the beginning of aCustom Objectclass definition, which must end with aCLASSENDverb.
Parameter
Description
accesslevel
The class access level must be specified, and must be eitherPUBLICorPRIVATE. APRIVATEclass is only visible to code within the same physical file. APUBLICclass can be accessed from code in other files.
classname
The class name must begin with a letter or underscore and can contain any combination of letters, numbers and underscores.
EXTENDSclassname
The optionalEXTENDSclause indicates that this class incorporates the methods of another specified Custom Object class. Theclassnamecan be:
The name of a class whose definition exists in the same program file
The name of a class specified in aUSEstatement in the same program file.
A fully qualified class name in the form::filename::classname.
IMPLEMENTSinterfacelist
The optionalIMPLEMENTSclause indicates that this class implements the method signatures of one or more comma-delimited Custom Object interfaces. Each of these interfaces can be:
The name of an interface whose definition exists in the same program file
The name of an interface in aUSEstatement in the same program file.
A fully qualified interface name in the form::filename::interfacename.
Notes
All BBj Custom Object names (interface name, class name, method name, field name) are case-sensitive.
The CLASS verb must be the only statement on the line (with one exception: it can end with a ; REM comment).
The CLASS verb is a syntax error unless the program also contains a CLASSEND verb on a subsequent line.
The CLASS verb may not be nested within any other CLASS, METHOD, or INTERFACE.
The class definition (the area between CLASS and CLASSEND) can containfieldsandmethods. Any other statements or labels contained within the class definition but not contained within a method definition are unreachable and will not be executed.
A class canimplementone or more Interfaces but cannotextendan Interface.
interface public Address
method public void address()
interfaceend
interface public Pay
method public void print()
interfaceend
interface public GL
method public BBjNumber account()
interfaceend
interface public Payable extends Pay, GL
method public BBjNumber pay()
interfaceend
class public Employee
field public BBjNumber ID
field public BBjString Name$
classend
class public Salaried extends Employee implements Payable
field public BBjNumber MonthlySalary
method public BBjNumber pay()
methodret #MonthlySalary
methodend
method public void print()
print "Employee",#getID(),": ",#getName()
print #pay():"($###,###.00)"
methodend
method public BBjNumber account()
methodret 11111
methodend
classend
class public Hourly extends Employee implements Payable
field public BBjNumber HourlyRate
field public BBjNumber HoursWorked
method public BBjNumber pay()
methodret #HourlyRate*#HoursWorked
methodend
method public void print()
print "Employee",#getID(),": ",#getName()
print #pay():"($###,###.00)"
methodend
method public BBjNumber account()
methodret 22222
methodend
classend