Esempio n. 1
0
        public void RunClientCode()
        {
            Console.WriteLine("***** START VISITOR *****");

            var            visitor    = new Visitor();
            BaseFootballer footballer = new Amator("Fred Blogs");

            Console.WriteLine(footballer.IntroduceYourself());

            // Bad Example
            BadExample(footballer);

            // Visitor example
            var salary = footballer.Accept(visitor);

            Console.WriteLine(salary);


            footballer = new Star("C. Ronaldo");
            Console.WriteLine(footballer.IntroduceYourself());
            salary = footballer.Accept(visitor);
            Console.WriteLine(salary);

            Console.WriteLine("***** END VISITOR *****");
        }
 public string PrepareContract(Amator amator)
 {
     return($"Footballer type: {amator.GetType().Name}, Salary: {10.ToString("C", CultureInfo.GetCultureInfo("pl-PL"))}");
 }