예제 #1
0
파일: Program.cs 프로젝트: rsahi1/OOP-Intro
        static void Main(string[] args)
        {
            // Declare two variables (object references)
            Greeter walmartEmployee, klingonWarrior;

            // Instantiate (create) the objects
            walmartEmployee = new Greeter("Welcome to Walmart!",
                                          "Thank you for shopping at Walmart!!");
            klingonWarrior = new Greeter("nuqneH! yI'el!",
                                         "Qapla'!");

            // Use the objects
            Console.WriteLine("The Walmart Employee sample:");
            Speak(walmartEmployee, "Dan");

            Console.WriteLine("The Klingon Warrior sample:");
            Speak(klingonWarrior, "Worf");
        }
예제 #2
0
파일: Program.cs 프로젝트: rsahi1/OOP-Intro
 static void Speak(Greeter someone, string name)
 {
     Console.WriteLine(someone.SayGreeting(name));
     Console.WriteLine(someone.SayGoodbye());
     Console.WriteLine(); // blank line
 }
예제 #3
0
 static void Speak(Greeter someone, string name)   // method with variable parameters
 {
     Console.WriteLine(someone.SayGreeting(name)); // output text for the method
     Console.WriteLine(someone.SayGoodbye());      // more output text for the method
     Console.WriteLine();                          // blank line
 }
예제 #4
0
 static void Speak(Greeter someone, string name)
 {
     Console.WriteLine(someone.SayGreeting(name));
     Console.WriteLine(someone.SayGoodbye());
     Console.WriteLine(); // blank line
 }