toString not working...

Johan Granberg lijat.meREM at OVE.gmail.com
Mon Jan 15 10:00:08 PST 2007


Orgoton wrote:

> I have
> 
> ushort number=1092;
> char[] text="Some text " ~ number.toString();
> 
> it doesn't compile because presumably ushort has no property called
> "toString" yet on digitalmars.com/d it says that toString is defined on
> class "object" and every type inherits from this object. Any ideas?

Every type does not inherit from object, every class does. As ushort is not
a class it has no such property. try this code instead;

import std.string;
toString(number);



More information about the Digitalmars-d mailing list