logo

Crowdly

Browser

Add to Chrome

Вихідний модуль містить визначення: interface IСмена {void Змінити(); } cl...

✅ 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

0%
0%
0%
0%
More questions like this

Want instant access to all verified answers on moodle.chnu.edu.ua?

Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!

Browser

Add to Chrome