Отсутствует аргумент, соответствующий требуемому формальному параметру - C# (183346)
Формулировка задачи:
Доброго времени суток! Столкнулась со следующей проблемой - при попытки передачи аргументов в конструктор - компилятор ругается. Подскажите, пожалуйста, в чем дело?
Код:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace ConsoleApplication14
{
class Program
{
static void Main(string[] args)
{
Human one = new Human("Ольга", 'ж', 22);//здесь
Console.ReadLine();
}
}
public class Human
{
public int age { get; set; }
public string name { get; set; }
public char sex { get; set; }
public Human( string n, char s, int a)
{
name = n;
sex = s;
age = a;
Console.WriteLine("Constructor result of Student creating:\n" + name + " " + sex + " " + age);
}
}
public class Student : Human
{
public string FathName;
public Student ( string fn, string n, char s, int a)
{
name = n;
sex = s;
age = a;
FathName = fn;
Console.WriteLine("Constructor result of Student creating:\n"+name+" "+FathName+" "+ sex+" "+age);
}
}
}Решение задачи: «Отсутствует аргумент, соответствующий требуемому формальному параметру»
textual
Листинг программы
public class Human
{
public int age { get; set; }
public string name { get; set; }
public char sex { get; set; }
protected Human() { /* Конструктор без параметров */}
public Human(string n, char s, int a)
{
name = n;
sex = s;
age = a;
Console.WriteLine("Constructor result of Student creating:\n" + name + " " + sex + " " + age);
}
}