1) Should I pass both [ImplStructure and ImplStructureHandler] to the Bayes class in its constructor?
2) Should I create the another variable in ImplStructureHandler to store the value of b and then only pass ImplStructureHandler to the Bayes Class.
Or If there is any another way Please share?
My Code:
public class ImplStructure {
private int a;
private int b;
public void build(int a, int b) {
this.a = a;
this.b = b;
}
public int getA() {
return a;
}
public int getB() {
return b;
}
}
public class ImplStructureHandler{
ImplStructure structure
public ImplStructureHandler(ImplStructure structure) {
this.structure = structure;
}
public int compTotal(int c) {
return c + structure.getA() + structure.getB();
}
}
public class Bayes {
public int doAddition(int d){
//here need value of b from Structure and c from Structure Handler to do: d = b + c
return d;
}
}
Aucun commentaire:
Enregistrer un commentaire