lundi 4 juillet 2016

Constructor in class cannot be applied to given types - Abstract Class

I know titular problems has been already answered here and over there, yet for every answer still cannot solves my problem. The problem is this :

I have abstract class which is Node, containing constructor like this :

public Node(List<Record> dataSet, int labelIndex) {
    this.allSamples = new ArrayList<Integer>();
    this.dataSet = dataSet;
    this.classificationLabelIndex = labelIndex;
    this.entropy = 0;
}

And then, I extend the absract class into TreeNode, containing constructor like this (to use super) :

public TreeNode(List<Record> dataSet, int labelIndex, List<Attribute> attributes, int level, double threshhold) {
    super(dataSet, labelIndex);
    this.attributes = attributes;
    splittedAttrs = new HashSet<Integer>();
    this.level = level;
    this.displayPrefix = "";
    this.children = null;
    this.threshhold = threshhold;
}

So, the TreeNode class extends abstract Node class and using super method to call dataset and labelindex from Node class, but then I get warning "constructor Node in class Node cannot be applied to given types, required no arguments." Maybe because I added some parameters in TreeNode, but I still think it's highly unlikely. Any help appreciated.

Aucun commentaire:

Enregistrer un commentaire