how do I overwrite the "toString" equivalent in Julia?

515 views
Skip to first unread message

Evan Pu

unread,
Feb 9, 2015, 6:04:51 AM2/9/15
to julia...@googlegroups.com
I have a type with a lot of fields, but when I want to print it I only want to output the name field of that type.
So when I print an array of objects of this type, I get a on the prinout an array of names instead of a huge clutter of prints.

how might I do that?
much thanks!!

Tobias Knopp

unread,
Feb 9, 2015, 7:50:39 AM2/9/15
to julia...@googlegroups.com
import Base.show

function Base.show(io::IO, m::MyType)
  print(io, "This is MyType")
end
Reply all
Reply to author
Forward
Message has been deleted
0 new messages