H (Hybrid) Language - v0.03, by Dr. Herong Yang
Execution of $instance Definition Body
This section describes when the $instance definition body is executed.
To support object properties and methods, the system generated __new() construction function will execute the code that defines object properties in the $instance definition body.
Example showing the execution of $instance definition body:
$class user: { $instance x: { write("Adding object properties..."); x.login = "guest"; x.password = "DontTell"; $method x.changePassword(newPassword): { x.password = newPassword; } } } # you will see the "Adding object properties..." message # when the following statement is executed. u = user(); # or user.__new(); # you will see the "Adding object properties..." message again x = user();
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