示例#1
0
        static void Main(string[] args)
        {
            Console.WriteLine("C# is good, but I am confused!");
            SecondExample secondExample = new SecondExample();

            CircleArea circleArea = new CircleArea(Math.PI);
            ForCounter forCounter = new ForCounter();

            // A demonstration of passing by reference. circleArea is sent to the factory, where its radius is changed. Now coming out of the factory, this object keeps the changed value.
            CircleAreaFactory circle = new CircleAreaFactory(circleArea, 12);

            circleArea.ComputeArea();

            if (!false)
            {
                Console.WriteLine("Don't forget that the logical not is exclaimation mark!");
            }

            byte andedvar = (~0x00) & (0x0F) | (0x08);   // So don't forget that this is the bitwise and

            Console.WriteLine(andedvar);

            Console.ReadKey();
        }
示例#2
0
 public CircleAreaFactory(CircleArea circleArea, double radius)
 {
     circleArea.radius = radius;
     circleArea.ComputeArea();
 }