.NET 4.x Непонятная ошибка, связанная с наследованием - C#
Формулировка задачи:
Здравствуйте. У меня такая проблема. Создал класс и 2 наследника. Вылетает 2 ошибки, типа:
Ошибки ссылаются на текст кода, выделенный комментарием
Собственно код:
В чем причина? Ведь конструктору родителя передал параметры
Ошибка 1 (название проекта).Text не содержит конструктор, который принимает 0 аргументов (путь)\TextForTeach.cs (/TextForDetermine.cs) 9 18 (название проекта)
public class Text
{
public int ID { get; set; }
public string Title { get; set; }
public string TextOrig { get; set; }
public string TextCleared { get; set; }
public status textStatus; //status - enum
public Text(string title, string originatText, int id, string textCleared, status statusOfText)
{
Title = title;
TextOrig = originatText;
ID = id;
textStatus = statusOfText;
if(textCleared==null)
ClearingText();
}
public void ClearingText() { //... }
}// Здесь
public class TextForTeach: Text
{
public TextForTeach(string title, string originatText, int id = 0, string textCleared = null)
: base(title, originatText, id, textCleared, status.Old)
{
if (id == 0)
this.textStatus = status.New;
}
}// Здесь
public class TextForDetermine : Text
{
public int categoryID;
public TextForDetermine(string title, string originatText, int id = 0, int catID = 0, string textCleared = null)
: base(title, originatText, id, textCleared, status.Old)
{
if (id == 0)
this.textStatus = status.New;
else if (catID == 0)
this.textStatus = status.Undetermined;
}
}Решение задачи: «.NET 4.x Непонятная ошибка, связанная с наследованием»
textual
Листинг программы
this.textStatus = status.New;