Consider the following two classes:
class A {
String _name;
char _type;
public A(String name, char type) {
_name = name; _type = type;
}
public int method1() {
do_something...;
}
public String method2() {
make_something...;
}
}
and
class B extends A {
public B(String name) {
super(name, 'a');
}
@Override
public int method1() {
do_something_else...;
}
@Override
public String method2() {
String answer = super.method2();
answer += more_processing...;
}
}
I am using inheritance here because the classes share many things in common. However, because I am overriding every single methods from the superclass, is it a good idea to use inheritance here?