This project is read-only.

InheritUSOClasses

USOClasses can inherit other USOClasses.

Define the class name that the inheritor inherits from.
And write it in the inheritor's constructor code.

[InheritorClassName].Constructor.code
param()
$baselist = @();
$baselist += "[ClassNameOfInheritFrom]";

$this | add-member -membertype noteproperty -name BaseClass -value $baselist -force;
$this;

For example:
Now we make a class named MyAltTestClass that inherits MyTestClass.
The link file is a text of the example.MyAltTestClass.Constructor.txt

If you did not do in AddUSOClasses, do it before this content.
Download MyAltTestClass.Constructor.txt and rename extension from .txt to .code, place to code folder.
In new session of SALAD, input follows.
[SALAD]
$myclass = new myalttestclass;
$myclass.echo("ABC");

Echo method in MyAltTestClass works, although no one defined in MyAltTestClass.
This is the inheritance.

Last edited Mar 2, 2013 at 2:01 PM by Tom__S, version 8

Comments

No comments yet.