I have three abstract
class
es:
public abstract class Shader
public abstract class ShaderInput
public abstract class ShaderOutput
The body of the Shader
class is very simple:
protected Function<ShaderInput, ShaderOutput> shader;
public Shader(Function<ShaderInput, ShaderOutput> shader){
this.shader = shader;
}
public ShaderOuput render(ShaderInput input){
return shader.apply(input);
}
I then have a VertexShader
which extends Shader
,
a VertexInput
which extends ShaderInput
,
and a VertexOutput
which extends ShaderOutput
What I don't understand is why my constructor in my VertexShader
class cannot be written as follows:
public VertexShader(Function<VertexInput, VertexOutput> vertexShader){
super(vertexShader);
}
When I type the incoming Function
as above, the IDE complains that
The constructor Shader(Function<VertexInput,VertexOutput>) is undefined
I would assume that because VertexInput extends ShaderInput
and VertexOutput extends ShaderOutput
that this would work and be able to provide more readability to the code.