H (Hybrid) Language - v0.03, by Dr. Herong Yang
$method Statement - Define Object Method
This section describes the $method statement for defining object (or instance) methods.
The $method statement is for defining object (or instance) methods within the instance template definition body using the following syntax:
$class class_name: { ... $instance template_name: { ... $method template_name.method_name(): {...}; ... } }
An object method is a special function that has an implicit argument refers to an object to which this function is applied.
Example of $method statements:
$class user: { $instance x: { x.login = "guest"; x.password = "DontTell"; # $method statement to define an object method $method x.changePassword(newPassword): { x.password = newPassword; } } }
Table of Contents
$class Statement - Create New Classes
Execution of $class Definition Body
__new() - Object Constructor Function
$instance Statement - Define Instance Template
Execution of $instance Definition Body
►$method Statement - Define Object Method
_first() Method - Object Initialization
Access Class Variables from Object Methods
__delete() - Object Destructor Method
$delete Statement - Delete Objects
_last() Method - Object Cleanup
Inheritance - Object Attachments