Quipex icon

лаба5 макс

Quipex | PRO | 05/18/16 08:44:30 PM UTC | 0 ⭐ | 299 👁️ | Never ⏰ | []
C# |

820 B

|

None

|

0 👍

/

0 👎

using System;
 
namespace Prov
{
    class programm
    {
        public static void Main()
        {
            B myB = new B(5,4);
            if (myB)
            Console.WriteLine("Объекты положительны");
            Console.ReadLine();
        }
    }
    public class B 
    {
        private int a;
        private int b;
        public B(int a = 0, int b = 0)
        {
            this.a = a;
            this.b = b;
        }
        public static bool operator true(B myB)
        {
            if ((myB.a > 0) && (myB.b > 0))
                return true;
            return false;
        }
        public static bool operator false(B myB)
        {
            if ((myB.a <= 0) || (myB.b <= 0))
                return true;
            return false;
        }
    }
 
}

Comments