Exemple #1
0
        // Instantiate one class from another class using a method.
        // Instatiate ClassTwo from ClassOne.
        public string ClassOneMethodTwoInstantiateClassTwo()
        //string classOneMethodTwoInstantiateClassTwoParameter
        {
            var classOneMethodTwoInstantiateClassTwoVariable = new ClassTwo();

            return(classOneMethodTwoInstantiateClassTwoVariable.ClassTwoMethodOne("ClassOneMethodTwoInstantiateClassTwo"));
            //return classOneMethodTwoInstantiateClassTwoParameter;
        }
Exemple #2
0
        static void Main(string[] args)
        {
            var classOneObject = new ClassOne();
            Console.WriteLine(classOneObject.classOneString);

            Console.WriteLine(ClassOne.classOneStaticString);

            Console.WriteLine(classOneObject.ClassOneMethodOne("classOneMethodOneArgument"));

            Console.WriteLine(classOneObject.ClassOneMethodTwoInstantiateClassTwo());

            var classTwoObject = new ClassTwo();
            Console.WriteLine(classTwoObject.classTwoString);

            Console.WriteLine(ClassTwo.classTwoStaticString);

            Console.WriteLine(classTwoObject.ClassTwoMethodOne("classTwoMethodOneArument"));

            Console.WriteLine(classTwoObject.ClassTwoMethodTwoInstantiateClassOne());

        }