An object that has a minimal string representation via its Printable.toStringShort method.

When writing a toString method, use toStringShort on objects that are Printable. This is mainly needed to avoid infinite loops, such as when an object prints a Subject or Observer.

This can also make printing an array of Printable objects more practical because we only print minimal identity information, rather than the full toString representation which would have too much information and be unreadable.

interface Printable {
    toStringShort(): string;
}

Hierarchy (view full)

Implemented by

Methods

  • Returns a minimal string representation of this object, usually giving just identity information like the class name and name of the object.

    For an object whose main purpose is to represent another Printable object, it is recommended to include the result of calling toStringShort on that other object. For example, calling toStringShort() on a DisplayShape might return something like this:

    DisplayShape{polygon:Polygon{'chain3'}}
    

    Returns string

    a minimal string representation of this object.

Generated using TypeDoc