I would like to automatically call a base class method for a class that inherits from the base class.
From the extent of my limited knowledge, I know I can do this using base.Method().
public abstract class Foo
{
private int a;
private float b;
public virtual void Init()
{
a = 1;
b = 2.5f;
}
}
public class Bar : Foo
{
public float c;
public Bar() { }
public override void Init()
{
base.Init();
c = 3.0f;
}
}
Is there any way I can automatically call the base Init method and the overriding method using just one call?
So if I were to override the base Init method in a derived class, then base.Init() would not need to be explicitly typed as it would be called automatically, along with the override Init method?