public static void Main()
    {
        int  i  = 0;
        Base b1 = new Derived();

        check(b1.Method(i) != 0, "b1.Method failed");
        check(b1.MethodForRenaming(i) != 0, "b1.MethodForRenaming failed");
        check(b1.MethodForRenamingConst(i) != 1, "b1.MethodForRenamingConst failed");
        check(b1.MethodWarningSuppressed(i) != 0, "b1.MethodWarningSuppressed failed");
        check(b1.NotVirtualMethod(i) != 0, "b1.NotVirtualMethod failed");
        check(b1.SimilarOverloadedMethod(i) != 0, "b1.NotVirtualMethod failed");

        Derived d1 = new Derived();

        check(d1.Method(i) != 0, "d1.Method failed");
        check(d1.MethodForRenaming(i) != 0, "d1.MethodForRenaming failed");
        check(d1.MethodForRenamingConst(i) != 1, "d1.MethodForRenamingConst failed");
        check(d1.MethodWarningSuppressed(i) != 0, "d1.MethodWarningSuppressed failed");
        check(d1.NotVirtualMethod(i) != 0, "d1.NotVirtualMethod failed");
        check(d1.SimilarOverloadedMethod(i) != 0, "d1.NotVirtualMethod failed");

        check(d1.AnotherMethod(i) != 0, "d1.AnotherMethod failed");

        Base db1 = BaseSwigImpl.inout(d1);

        check(db1.Method(i) != 0, "db1.Method failed");
        check(db1.MethodForRenaming(i) != 0, "db1.MethodForRenaming failed");
        check(db1.MethodForRenamingConst(i) != 1, "db1.MethodForRenamingConst failed");
        check(db1.MethodWarningSuppressed(i) != 0, "db1.MethodWarningSuppressed failed");
        check(db1.NotVirtualMethod(i) != 0, "db1.NotVirtualMethod failed");
        check(db1.SimilarOverloadedMethod(i) != 0, "db1.NotVirtualMethod failed");

        MoreDerived m1 = new MoreDerived();

        check(m1.Method(i) != 0, "m1.Method failed");
        check(m1.MethodForRenaming(i) != 0, "m1.MethodForRenaming failed");
        check(m1.MethodForRenamingConst(i) != 1, "m1.MethodForRenamingConst failed");
        check(m1.MethodWarningSuppressed(i) != 0, "m1.MethodWarningSuppressed failed");
        check(m1.NotVirtualMethod(i) != 0, "m1.NotVirtualMethod failed");
        check(m1.SimilarOverloadedMethod(i) != 0, "m1.NotVirtualMethod failed");

        check(m1.AnotherMethod(i) != 0, "m1.AnotherMethod failed");

        Base mb2 = BaseSwigImpl.inout(m1);

        check(mb2.Method(i) != 0, "mb2.Method failed");
        check(mb2.MethodForRenaming(i) != 0, "mb2.MethodForRenaming failed");
        check(mb2.MethodForRenamingConst(i) != 1, "mb2.MethodForRenamingConst failed");
        check(mb2.MethodWarningSuppressed(i) != 0, "mb2.MethodWarningSuppressed failed");
        check(mb2.NotVirtualMethod(i) != 0, "mb2.NotVirtualMethod failed");
        check(mb2.SimilarOverloadedMethod(i) != 0, "mb2.NotVirtualMethod failed");
    }
Ejemplo n.º 2
0
        // instantiate objects and call methods from any of the below classes to write
        // "Never send a human to do a machine's job."
        // to the console
        static void Exercise3()
        {
            MoreDerived a = new MoreDerived();

            a.Print();
// Finished f = new Finished();
// f.Print();
            MoreDerived2 b = new MoreDerived2();

            b.Print();
// Derived d = new Derived();
// Base g;
        }
        // instantiate objects and call methods from any of the above classes to write
        // "Never send a human to do a machine's job."
        // to the console
        public void Exercise3()
        {
            Derived  derived  = new Derived();
            Finished finished = new Finished();

            finished.Print();
            MoreDerived moreDerived = new MoreDerived();


            Derived derivedb = new Derived();


            moreDerived.Print();
            MoreDerived2 derived2 = new MoreDerived2();


            derived2.Print();
        }
Ejemplo n.º 4
0
    //Never send a human to do a machine's job.
    public static void Main()
    {
        Derived  start       = new Derived();
        Finished humanGetter = new Finished();

        start.ToString();
        humanGetter.printHuman();
        humanGetter.Print();
        MoreDerived morestart = new MoreDerived();
        IWord       test      = (IWord)morestart;

        test.Print();
        morestart.Print();
        MoreDerived2 morestart2 = new MoreDerived2();

        morestart2.Print();

        Console.ReadLine();
    }
Ejemplo n.º 5
0
    static void Main()
    {
        Base x = new MoreDerived();

        x.Foo();     // Prints Derived.Foo
    }
 static void AsOperator()
 {
     Derived     d  = new Derived();
     Base        b  = d as Base;        // not null reference to derived
     MoreDerived md = d as MoreDerived; // null
 }