✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
public class One {
public string s; public int n;
public One (string s, int n) {this.s = s; this.n = n;}}
public struct Two {
public string s; public int n;
public Two (string s, int n) {this.s = s; this.n = n;}}
Нехай в клієнтському класі створені об'єкти
One cx = new One ( "Петров", 5), cy = new One ( "Петров", 5), cz = new One ( "Миронов", 4);
Two sx = new Two ( "Петров", 5), sy = new Two ( "Петров", 5), sz = new Two ( "Миронов", 4);
int res = 0;
В результаті виконання фрагмента коду
if (cx == cy) res = 1;
else if (sx.Equals (sy)) res = 5;
cx = cz; sx = sz; cz.n = 3; sz.n = 3;
if (cx.n == 3) res ++;
else if (sx.n == 3) res + = 2;
Яке значення отримає змінна res ?
( *** CSharp 3.1 *** )