I’d like to hide some parent’s methods from particular ancestors. However, I can’t figure out how to do that.
Let’s say we’ve got:
class GrandPa {
// must not be accessible from the GrandSon:
protected gradPaDoing() {}
}
class Parent extends GrandPa {
// Here probably must be some kind of adapter between GrandPa and GrandSon...
}
class GrandSon extends Parent {
grandSonDoing() {
this.gradPaDoing(); // I'd like to make it impossible
}
}
Is there a way to achieve it?