I am wondering if it is possible to skip a class in the inheritance three if you want to inherit a method from the original base, not your direct predecessor.
For example, lets say I have three classes, GrandParent, Parent (inherits from GrandParent) and Child (inherits from Parent). GrandParent has a method Adresse, and Parent has a method Adresse who overrides this. However, say that for some reason, I want Child to have the same Adresse method as GrandParent, not Parent. Is that possible or have I messed up if I get in a situation like that?
The example code below is in C#
class GrandParent
{
private String Adresse;
public GrandParent()
{
}
public virtual void setAdress(String Adresse)
{
this.Adresse = Adresse;
}
public String getAdress()
{
return Adresse;
}
}
class Parent : GrandParent
{
public Parent()
:base()
{
}
public override void setAdress(String Adresse)
{
base.setAdress("Home: " + Adresse);
}
}
class Child : Parent
{
public Child()
: base()
{
}
}