vendredi 12 juin 2015

"is not abstract and does not override abstract method java" using Decorator Pattern

public abstract class AdicionalesCpd extends Cpd{
public abstract int getCpu();
public abstract int getRam();
public abstract int getDisco();
public abstract String getCadena();}

This my abstract class for the decorator pattern, and I have this problem when it compiles:

**error: Cpu is not abstract and does not override abstract method getCadena() in AdicionalesCpd

public class Cpu extends AdicionalesCpd{ ** I don't know why doesn't override the method "getCpu"

This is my Cpu class which is a "decoration" in the pattern

public class Cpu extends AdicionalesCpd{

Cpd cpd;
int var;

public Cpu(Cpd cpd,int var)
{
    this.cpd=cpd;
    this.var=var;   
}

@Override
public int getCpu() {

    return  cpd.getCpu()+var;

}

}

Aucun commentaire:

Enregistrer un commentaire