H (Hybrid) Language - v0.03, by Dr. Herong Yang
Access Object Methods
This section describes how to access object methods.
Once an object is created, you can use the dot (.) expression to access its methods.
Examples of accessing object methods:
$class user: { $instance x: { x.login = "guest"; x.password = "DontTell"; $method x.changePassword(newPassword): { x.password = newPassword; } $method x.showPassword(): { write(x.password); } } } u = user(); u.showPassword(); accessing object methods u.changePassword("******"); u.showPassword();
By default, all object methods are publicly accessible. Private methods will be introduced later.
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