Beispiel #1
0
            void Start()
            {
                /* which UniqueClass to use?        */

                //UniqueClass uniqueClass = new AnotherNamespace.UniqueClass();

                /* this is more specific */
                AnotherNamespace.UniqueClass uniqueClass = new AnotherNamespace.UniqueClass();
                Chapter6_10_2.SecondNamespace.UniqueClass secondUniqueClass = new Chapter6_10_2.SecondNamespace.UniqueClass();
            }
Beispiel #2
0
    void Start()
    {
        {
            MyClass myClass = new MyClass();
            //myClass.MyFunction();

            /*
             * This version of MyClass comes from ClassData.cs
             */

            MyNamespace.MyClass nsClass = new MyNamespace.MyClass();
            nsClass.MyFunction();

            //UniqueClass uClass = new UniqueClass();
            //uClass.MyFunction();

            /*
             * Uncomment the above to see the error caused by including
             * the using AnotherNamespace; directive.
             * alternatively, comment out the using AnotherNamespace;
             * directive to see that the UniqueClass is referencing
             * the MyNamespace version of the class identifier.
             */

            AnotherNamespace.UniqueClass anClass = new AnotherNamespace.UniqueClass();
            anClass.MyFunction();

            MyNamespace.SubSpace.MyClass subClass = new MyNamespace.SubSpace.MyClass();
        }
        {
            /*
             * Section 6.10.5 Putting Namespaces to Work
             */
            zombieMonster = new ZombieMonster();
            AttackMonster();
        }
    }