Я пытаюсь создать базовый класс с одинаковыми действиями, но Мне нужно, чтобы переменные были свойством, чтобы я мог определить каждый класс.
Вот пример
Код: Выделить всё
public class Calc
{
//For every object class, the SimpleMsg is a different global string.. I'm not sure how to define this.
public string SimpleMsg { get; set; }
public string FullMsg { get; set; }
public double rt { get; set; }
public Calc() { }
public double Exe()
{
Start();
calc();
return calc();
}
public virtual double calc()
{
rt = 0;
return rt;
}
private void Start()
{
}
}
Код: Выделить всё
public class methodCalc1 : Calc
{
public override double calc()
{
rt = 0;
return rt;
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... onstructor
Мобильная версия