Что не так с конструктором? - C#
Формулировка задачи:
Изучаю конструктор, попробовал создать программку, а вышла ахинея...
На консоле отображает не попорядку(как должно быть(сначала Type, Name, PlaceWhereBorned...)), а почему то произвольно(сначала couple, food, type...)...
Что не так делаю?
class Program
{
static void Main(string[] args)
{
//type, Name, PlaceWhereBorned, PlaceWhereLive, Couple, food, breed
Animal whitebear = new Animal("White bear", "Loly", "Berlin", "NorthPole", "Hasn't", "Fish", "King", 8);
whitebear.DescribeOfAnimal();
Console.ReadLine();
}
}
class Animal
{
string Name, PlaceWhereBorned, PlaceWhereLive, Couple, Type, Breed, Food;
int Date;
public Animal(string name, string borned, string live, string couple, string type, string breed, string food, int date)
{
Name = name;
PlaceWhereBorned = borned;
PlaceWhereLive = live;
Couple = couple;
Type = type;
Breed = breed;
Food = food;
Date = date;
}
public void DescribeOfAnimal()
{
Console.WriteLine("У нас есть {0}, а порода {6}. Зовут ее {1}, ей {7} лет, это животное родилось {2}," +
"а живет оно в {3}. У нее {4} второй половинки, а питается она {5}", Type, Name, PlaceWhereBorned, PlaceWhereLive, Couple, Food, Breed, Date);
}
}Решение задачи: «Что не так с конструктором?»
textual
Листинг программы
public Animal(string type, string name, string borned, string live, string couple, string food, string breed, int date)
{
Name = name;
PlaceWhereBorned = borned;
PlaceWhereLive = live;
Couple = couple;
Type = type;
Breed = breed;
Food = food;
Date = date;
}