$trim Statement - Detach Objects

This section describes the $trim statement for detaching appended objects from the current object.

The $trim statement for detaching the last appended object from the current object using the following syntax:

$trim object_reference;

Examples of using $trim statements:

$class person: {
   $instance x: {
      x.name = "John";
	  $method x.changeName(newName): {
	     x.name = newName; 

$class employee: {
   $instance x: {
      x.status = "Part-time";
	  $method x.changeStatus(newStatus): {
	     x.status = newStatus;

e = employee();

$append e $with person();

$trim e;
e.changeName("Yang"); # gets UnknowMethod error

Design options:

1. Use $trim as the keyword for detaching objects. This makes the "$trim a" statement more readable.

2. Use $detach as the keyword for detaching objects.

Last update: 2017.

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

 Object Oriented Programming

Inheritance - Object Attachments

 What Is Object Attachment

 $append Statement - Attach Objects

 Name Collision in Attached Objects

 Append Multiple Object Attachments

$trim Statement - Detach Objects

 Build Subclasses with Superclasses

 Object Morphinism by Changing Attachments

 Encapsulation - Private Members


 PDF Printing Version