abstract function templates

Nrgyzer nrgyzer at gmail.com
Sun Dec 26 13:19:13 PST 2010


Hey guys,

I've the following class:

abstract class Drawable {

	public {

		uint getHeight() { ... }
		uint getWidth() { ... }

		abstract {
			void draw(T = void*)(uint zPos, T obj = null);
		}

	}

}

When I compile this code, it compiles without any errors.

Now... I have the following class:

class Texture : Drawable {

	public {

		override {
			void draw(T = void*)(uint zPos, T obj = null)
{ ... }
		}

	}

}

When I create a new instance of Texture and try to call
newInstance.draw(50), I always get the following error:

"Error: variable Texture.draw!(void*).draw.this override cannot be
applied to variable"
"Error: variable Texture.draw!(void*).draw.zPos override cannot be
applied to variable"
"Error: variable Texture.draw!(void*).draw.pbo override cannot be
applied to variable"
"Error: variable ... Texture.draw!(void*).draw.zPos override cannot
be applied to variable"

I hope anyone can help me - thanks!


More information about the Digitalmars-d-learn mailing list