static void Main(string[] args)
        {
            int num1 = 2;
            int num2 = 3;
            int result;

            studentStudent firstStudentStudent = new studentStudent();

            firstStudentStudent.firstName = "John";
            firstStudentStudent.lastName = "Smith";
            firstStudentStudent.grade = "six";

            result = sum(num1, num2);
            Console.Write("Sum is: ");
            Console.WriteLine(result);  // outputs 5
            Console.WriteLine();

            changeValues(num1, num2);
            Console.WriteLine();
            Console.WriteLine("Back from changeValues()");
            Console.WriteLine(num1);  // outputs 2
            Console.WriteLine(num2);  // outputs 3

            Console.WriteLine();
            Console.WriteLine("First name for firstStudentStudent is " + firstStudentStudent.firstName);
            changeName(firstStudentStudent);
            Console.WriteLine();
            Console.WriteLine("First name for firstStudentStudent is " + firstStudentStudent.firstName);
        }
Example #2
0
        static void Main(string[] args)
        {
            int num1 = 2;
            int num2 = 3;
            int result;

            studentStudent firstStudentStudent = new studentStudent();

            firstStudentStudent.firstName = "John";
            firstStudentStudent.lastName  = "Smith";
            firstStudentStudent.grade     = "six";

            result = sum(num1, num2);
            Console.Write("Sum is: ");
            Console.WriteLine(result);  // outputs 5
            Console.WriteLine();

            changeValues(num1, num2);
            Console.WriteLine();
            Console.WriteLine("Back from changeValues()");
            Console.WriteLine(num1);  // outputs 2
            Console.WriteLine(num2);  // outputs 3

            Console.WriteLine();
            Console.WriteLine("First name for firstStudentStudent is " + firstStudentStudent.firstName);
            changeName(firstStudentStudent);
            Console.WriteLine();
            Console.WriteLine("First name for firstStudentStudent is " + firstStudentStudent.firstName);
        }
 static void changeName(studentStudent refValue)
 {
     Console.WriteLine();
     Console.WriteLine("In changeName()");
     refValue.firstName = "George";
 }
Example #4
0
 static void changeName(studentStudent refValue)
 {
     Console.WriteLine();
     Console.WriteLine("In changeName()");
     refValue.firstName = "George";
 }