_last() Method - Object Cleanup

This section describes the _first() method for object cleanup.

The _last() method is for object cleanup during the object destruction process. To write the _last() method, you need to follow these rules:

Example of specifying the _last() method:

$class user: {
   counts = 0;
   $instance x: {
      $method x._first(l="guest", p="DontTell"): {
         x.login = l;
		 x.password = p;
      $method x._last(): {

a = user(); 
b = user("herong"); 
c = user(p="******"); 
write(user.counts); # prints 3

$delete a;
write(user.counts); # prints 2

Table of Contents

 About This Book

 Introduction of H Language


 Data Types




 "boolean" Data Type

 "integer" Data Type

 "string" Data Type

 "real" Data Type

 "array" Data Type

 Source Code Packages

Classes and Objects

 What Is Class

 What Is Object

 $class Statement - Create New Classes

 Class Variables and Functions

 Execution of $class Definition Body

 __new() - Object Constructor Function

 $instance Statement - Define Instance Template

 Execution of $instance Definition Body

 Access Object Properties

 $method Statement - Define Object Method

 Access Object Methods

 _first() Method - Object Initialization

 Access Class Variables from Object Methods

 __delete() - Object Destructor Method

 $delete Statement - Delete Objects

_last() Method - Object Cleanup

 Object Oriented Programming

 Inheritance - Object Attachments

 Encapsulation - Private Members


 Full Version in PDF/ePUB