overload/ride

Ant duitoolkit at yahoo.ca
Sat May 19 20:03:07 PDT 2007


I'm trying to use tango and I found Cout doesn't take int.
Before trying to figure out why I did this:

import tango.io.Console;

class MOutput : Console.Output
{
	this()
	{
		super(cast(tango.io.Console.Console.Conduit)Cout.conduit(), 
Cout.redirected());
	}
	
//	Console.Output opCall(char[] i)
//	{
//		return this;
//	}

	Console.Output opCall(int i)
	{
		return this;
	}

}

void main()
{
     (new MOutput()) ("Hello, sweetheart \u263a")(14).newline;
}

looks fine right?
but D doesn't like it I get:
t1.d(24): Error: cannot implicitly convert expression ("Hello, 
sweetheart \xe2\x98\xba") of type char[21] to int

Am I doing something wrong? is this a D limitation?
where is the super.opCall(char[]) hiding?

adding the commented out method results in the error:
function alias tango.io.Console.Console.Output.append (char[]) does not 
match parameter types (int)


now where did the overloaded opCall(int) go?

???

Ant


More information about the Digitalmars-d-learn mailing list