H (Hybrid) Language - v0.03, by Dr. Herong Yang
Name Collision in Attached Objects
This section describes how to resolve name collision in attached objects.
If a property name or method name in an attached object is identical to one of properties or methods in the primary object, the primary object wins.
In other words, if a property or method in an attached object is identical to one of properties or methods in the primary object, that property or method become in accessible.
Examples of name collision in attached objects:
$class person: { $instance x: { x.id = 0; x.name = "John"; $method x.changeName(newName): { x.name = newName; } } } $class employee: { $instance x: { x.id = 1; x.status = "Part-time"; $method x.changeStatus(newStatus): { x.status = newStatus; } } } e = employee(); $append e $with person(); write(e.id); # prints 1, "employee" object wins p = person(); $append p $with employee(); write(p.id); # prints 0, "person" object wins
Table of Contents
►Inheritance - Object Attachments
$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