Let’s say I have 3 classes:
GrandDad, Dad and Son. Son inherits from Dad, which inherits from GrandDad.
GrandDad has 2 methods:
public virtual void foo();
public virtual void do();
Dad inherits foo(), but overrides do();
public override void do();
If Son wants to modify foo(), is it acceptable to:
make Dad override foo(), but simply call foo.base()? Then Son can override foo(), but Dad’s foo() functionality remains the same?
Or is that a hacky way?
As long as
Dadnever defined afoo(), there’s no reason he has to do anything.Sonshould be able to overridefoo()fromGrandDad.