Example #1
0
    private void Start()
    {
        Machine m = new Machine();

        Printer1 p1 = new Printer1();
        Printer2 p2 = new Printer2();

        p2.PrintNum(10, p1.Printx10);
        p2.PrintNum(10, p1.PrintNormal);



        Box <Banana>    b_box = new Box <Banana>();
        Box <Pineapple> p_box = new Box <Pineapple>();
        Box <Guava>     g_box = new Box <Guava>();
        Box <Apple>     a_box = new Box <Apple>();
        Box <Mango>     m_box = new Box <Mango>();
        Banana          b     = new Banana(b_box);
        Banana          b2    = new Banana(b_box);
        Banana          b3    = new Banana(b_box);
        Apple           a     = new Apple(a_box);
        Apple           a2    = new Apple(a_box);

        // float total_sum = 0;
        // float wtf = 0;
        float easy_total = 0;

        // more easier computing
        easy_total += m.EasyCompute <Banana>(m.EasyGetWeight <Banana>, b_box);
        easy_total += m.EasyCompute <Pineapple>(m.EasyGetWeight <Pineapple>, p_box);
        easy_total += m.EasyCompute <Guava>(m.EasyGetWeight <Guava>, g_box);
        easy_total += m.EasyCompute <Apple>(m.EasyGetWeight <Apple>, a_box);
        easy_total += m.EasyCompute <Mango>(m.EasyGetWeight <Mango>, m_box);
        Debug.Log("total sum is :  " + easy_total);

        /*
         * // wtf
         * wtf += m.real_compute<Box<Banana>,Banana>(m.ComputeWeight<Box<Banana>, Banana>,b_box);
         * wtf += m.real_compute<Box<Pineapple>, Pineapple>(m.ComputeWeight<Box<Pineapple>, Pineapple>, p_box);
         * wtf += m.real_compute<Box<Guava>, Guava>(m.ComputeWeight<Box<Guava>, Guava>, g_box);
         * wtf += m.real_compute<Box<Apple>, Apple>(m.ComputeWeight<Box<Apple>, Apple>, a_box);
         * wtf += m.real_compute<Box<Mango>, Mango>(m.ComputeWeight<Box<Mango>, Mango>, m_box);
         * Debug.Log("WTF is this " + wtf);
         * total_sum += m.ComputeWeight<Box<Banana>, Banana>(b_box);
         * total_sum += m.ComputeWeight<Box<Pineapple>, Pineapple>(p_box);
         * total_sum += m.ComputeWeight<Box<Guava>, Guava>(g_box);
         * total_sum += m.ComputeWeight<Box<Apple>, Apple>(a_box);
         * total_sum += m.ComputeWeight<Box<Mango>, Mango>(m_box);
         * Debug.Log(total_sum);
         */

        //Debug.Log(b_box.GetBoxWeight());
        //Debug.Log("total amount = " + m.Compute());
    }
Example #2
0
 static void Main()
 {
     Printer1 print1 = new Printer1("one");
     Printer2 print2 = new Printer2("two");
 }