CLASS
Define a Class for Object Oriented Programming
- Syntax
- CLASS <ClassName> [ <FROM, INHERIT> <SuperClass> ]
- Arguments
- <ClassName> Name of the class to define. By tradition, Harbour classes start with "T" to avoid collisions with user- created classes.
- <SuperClass> The Parent class to use for inheritance
- Description
- CLASS creates a class from which you can create objects. Each Class is defined in a separate .PRG file dedicated to that purpose. You cannot create more than one class in a .PRG. After the CLASS command begins the definition, the DATA elements (also known as instance variables) and METHODS of the class are named.
- Classes can inherit from a single , but the chain of inheritance can extend to many levels.
- A program uses a Class by calling the Class Constructor, the New() method, to create an object. That object is usually assigned to a variable, which is used to access the DATA elements and methods.
- Examples
- CLASS TBColumn
- DATA Block // Code block to retrieve data for the column
- DATA Cargo // User-definable variable
- DATA ColorBlock // Code block that determines color of data items
- DATA ColSep // Column separator character
- DATA DefColor // Array of numeric indexes into the color table
- DATA Footing // Column footing
- DATA FootSep // Footing separator character
- DATA Heading // Column heading
- DATA HeadSep // Heading separator character
- DATA Width // Column display width
- DATA ColPos // Temporary column position on screen
- METHOD New() // Constructor
- ENDCLASS
- Status
Ready
- Compliance
- CLASS is a Harbour extension.
- Platforms
- All
- See Also