Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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;
- }
- }
- }
Add Comment
Please, Sign In to add comment