✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
interface IСмена {void Змінити(); }
class Перемикач: IСмена
{
bool s;
public Перемикач (bool s) {this.s = s;}
public void Змінити() {s =! s; System.Console.Write ( "" + s); }
}
class Лічильник: IСмена
{
int s;
public Лічильник (int s) {this.s = s; }
public void Змінити() {s ++; System.Console.Write ( "" + s); }
}
У цьому ж модулі визначено клас Program c методом Main(), в якому міститься наступний код:
IСмена a = new Перемикач (false);
IСмена b = new Лічильник(1);
a.Сменіть(); a = b; a.Сменіть(); b.Сменіть(); a.Сменіть();
Вкажіть результат виведення на консоль після виконання методу Main():
C# oop_class