You have a better idea of your context, so if this make sense to you, then you should stick with it. After all, a lot of programming is subjective, so go with whatever fits in your brain the best!
But to hopefully explain what I meant, here’s a different example:
class Animal{
Animal(){
registerMethod("draw", this);
}
void draw(){
println("hello I'm an animal");
}
}
class Cat extends Animal{
Animal animal;
void draw(){
super.draw();
println("meow");
}
}
In this example, it’s not clear to me why Cat needs to both extend Animal and contain an Animal variable. It’s also not clear to me why I should use registerMethod() instead of doing something like this:
Animal myAnimal = new Animal(); //could also be new Cat()
void draw(){
myAnimal.draw();
}
But like I said, if your setup makes sense for your context, then feel free to ignore me!