H (Hybrid) Language - v0.03, by Dr. Herong Yang
_first() Method - Object Initialization
This section describes the _first() method for object initialization.
The _first() method is for object initialization during the new object construction process. To write the _first() method, you need to follow these rules:
Example of specifying the _first() method:
$class user: { $instance x: { x.login; x.password; $method x._first(l="guest", p="DontTell"): { x.login = l; x.password = p; }; $method x.changePassword(newPassword): { x.password = newPassword; } $method x.showPassword(): { write(x.password); } } } u = user(); # _first() is called with default arguments u = user("herong"); # _first() is called with a positioned argument u = user(p="******"); # _first() is called with named argument
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