Ошибка: An object reference is required for the nonstatic field, method or property - C#
Формулировка задачи:
using System;
using System.Collections.Generic;
using System.Text;
namespace ConsoleApplication5
{
class Butterfly
{
public string wings;
public void Fly()
{
wings = Console.ReadLine();
for (int i = 1; i < 101; i++)
{
Console.Write(i + " " + wings + " ");
}
}
static void Main(string[] args)
{
Butterfly mahaon = new Butterfly();
do
{
mahaon.Fly();
} while (wings != "exit");
System.Console.ReadLine();
}
}
}Решение задачи: «Ошибка: An object reference is required for the nonstatic field, method or property»
textual
Листинг программы
/*line 26:*/} while (mahaon.wings != "exit"); // FIXED