H (Hybrid) Language - v0.03, by Dr. Herong Yang
__new() - Object Constructor Function
This section describes what is object constructor function.
Object constructor function, __new(), is a special class function automatically created by the H system when a $class statement is executed. You should never create your own version of __new() function to override the system created version.
The syntax to call the constructor function is:
class_name.__new();
But a shorthand version is supported:
class_name(); # shorthand version of the following class_name.__new();
Examples of calling object constructor functions:
# an empty class $class dummy: {}; b = dummy.__new(); # creates a "dummy" object d = dummy(); # creates a "dummy" object
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