C#C
C#3y ago
Kleidukos

❔ Call base method in multiple inheritance

Example of what i have:
public class A
{
  public virtual void Foo()
  {
    Console.Write("Hello ");
  }
}

public class B : A
{
  public override void Foo()
  {
    Console.Write("World");
    base.Foo();
  }
}

public class C : B
{
  public override void Foo()
  {
    Console.Write("!");
    base.Foo();
  }
}


When i call C#Foo() i get "Hello World!" but i only want to call the base method of A so my console result would be "Hello !"

I hope you guys can understand what i want.
How can i doing this
Was this page helpful?