예제 #1
0
파일: Program.cs 프로젝트: g-un--/CSCourse
        static void Main(string[] args)
        {
            Console.WriteLine("What type is declared when delegate keyword is used?");
            Console.WriteLine(typeof(Learn).BaseType.ToString());

            Console.WriteLine();

            Student student = new Student();
            ProgrammingCourse course = new ProgrammingCourse();
            student.AttendToCourse(course);

            //After a long time student will call
            student.StartLearningBecauseExamIsTomorrow();

            Console.Read();
        }
예제 #2
0
파일: Program.cs 프로젝트: g-un--/CSCourse
 public void AttendToCourse(ProgrammingCourse course)
 {
     /*Instead of just learning and calling: course.StudyFirstChapter()
      * every lazy student will postpone this job and will add it to "toStudyDelegate" */
     toStudyDelegate += course.StudyFirstChapter;
 }