Exemplo n.º 1
0
        static void Main(string[] args)
        {
            Program1 p1 = new Program1()
            {
                i = 0
            };
            Program1 p2 = new Program1()
            {
                i = 3
            };

            if (p1)
            {
                Console.WriteLine("Object p1:non zero");
            }
            else
            {
                Console.WriteLine("Object p1:zero");
            }
            if (p2)
            {
                Console.WriteLine("Object p2:non zero");
            }
            else
            {
                Console.WriteLine("Object p2:zero");
            }
            Console.ReadKey();
        }
        static void Main(string[] args)
        {
            Program1 p1 = new Program1()
            {
                i = 0
            };
            Program2 p2 = new Program2()
            {
                i = 3
            };

            if (p2 & p1)
            {
                Console.WriteLine("Both are non ZERO");
            }
            if (p2 | p1)
            {
                Console.WriteLine("Atleast one is non ZERO");
            }
            if (!p2)
            {
                Console.WriteLine("Negation of object p2 is non ZERO");
            }
            else
            {
                Console.WriteLine("Negation of object p2 is ZERO");
            }
            Console.ReadKey();
        }
Exemplo n.º 3
0
        static void Main(string[] args)
        {
            Program1 p1 = new Program1()
            {
                i = 0
            };
            Program1 p2 = new Program1()
            {
                i = 3
            };

            if (p1 && p2)
            {
                Console.WriteLine("Both of them are non-ZERO");
            }
            if (p1 || p2)
            {
                Console.WriteLine("Atleast one ofthem is non-ZERO");
            }
            Console.ReadKey();
        }