View difference between Paste ID: y84SN8MM and d6yYRkAP
SHOW: | | - or go back to the newest paste.
1
using System;
2
3
namespace Prov
4
{
5
    class programm
6
    {
7
        public static void Main()
8
        {
9
            B myB = new B(5,4);
10
            if (myB)
11
            Console.WriteLine("Объекты положительны");
12
            Console.ReadLine();
13
        }
14
    }
15
    public class B 
16
    {
17
        private int a;
18
        private int b;
19
        public B(int a = 0, int b = 0)
20
        {
21
            this.a = a;
22
            this.b = b;
23
        }
24
        public static bool operator true(B myB)
25
        {
26
            if ((myB.a > 0) && (myB.b > 0))
27
                return true;
28
            return false;
29
        }
30
        public static bool operator false(B myB)
31
        {
32
            if ((myB.a <= 0) || (myB.b <= 0))
33
                return true;
34
            return false;
35
        }
36
    }
37
38
}