I have an abstract class that is extended to provide the standard methods and variables that I need. This time, however, I need to extend one class, but some variables and some methods do not help me. So I was wondering if it is useless to disable these variables / methods. I point out that I am forced to extend this class, I cannot create another. For example, I have this abstract class:
public abstract class A {
protected int a, b, c;
public abstract void A();
public abstract void B();
public abstract void C();
}
public class B extends A {
public B() {
a = 5;
b = 7;
A();
B();
}
public void A() {
System.out.println("A: " + a);
}
public void B() {
System.out.println("B: " + b);
}
}
Actually, I don’t know if this is worth doing, I rely on your knowledge.
source
share