Yes it works like this for print
, String interpolation or Angular mustaches.
By overriding the String toString()
method on your object the displayed value will be the result of this toString()
call. If there's no toString()
defined in the class hierarchy the toString()
of Object
will be called (which will return Instance of 'MyClass'
for class MyClass{}
).