How to determine if a function is implemented

JS js.mdnq at gmail.com
Thu Jul 4 18:27:04 PDT 2013


the code

http://dpaste.dzfl.pl/25bfeeb7

attempts to implement an interface. The current issue is that I 
need to determine if the user has added the member of the 
interface to the class or if the mixin needs to add it.


so the lines

class B : A
{
	A a;
	
	//void myfunc(float a, int b, string c) { };
	//@property int myvalue() { return 4; }
	mixin implementInterface!a;
}

The mixin adds the two commented functions above it which 
effectively implement the interface A in B. The problem is, I 
might want to manually specify one, e.g.,


class B : A
{
	A a;
	
	void myfunc(float a, int b, string c) { };
	//@property int myvalue() { return 4; }
	mixin implementInterface!a;
}

So the mixin needs to be aware and not add a method that is 
already implemented.
I need some way for the mixin to distinguish the two cases above. 
e.g., isImplemented!(myfunc(float, int, string)) or something 
like that.



More information about the Digitalmars-d-learn mailing list