I would like the derived classes to get there constructor from the base class and declare the parameters when the derived classes are created. Is that possible without declaring each individual parameters in the derived classes? It’s not very practical as if I change the number of parameters in the base class I have to manually update all the derived classes. Surely there is a better way to get all parameters from the base class?
public abstract class Base
{
protected string myString;
protected float myFloat;
protected Base(string myString, float myFloat)
{
this.myString= myString;
this.myFloat= myFloat;
}
}
public class Derived: Base
{
public Derived(string myString, float myFloat) : base(myString, myFloat) { }
}
Any help would be appreciated!