This is my first post here and I'll try to be short and specific.
I have the class Neuron
, which contains a private field Class<? extends ActFunction> function;
Whenever I create one of these Neuron
s, I pass to the constructor a subclass of ActFunction
to be assigned to that field, all of the ActFunction
subclasses have the method activate(double[] values)
, but when I try to invoke the method inside my Neuron
by doing this:
Method activate = this.function.getClass().getMethod("activate");
return (double) activate.invoke(this, inputs);
it says that the method couldn't be found.
What am I doing wrong here? I'm not really an expert of reflection so I guess I'm missing some basic knowledge here.
Aucun commentaire:
Enregistrer un commentaire