Exemple #1
0
        private void Form1_Load(object sender, EventArgs e)
        {
            //TeachingAssistant ta = new TeachingAssistant();
            TeachingAssistant4 ta = new TeachingAssistant4();

            // The following causes a design time error for the
            // TeachingAssistant4 class but not the TeachingAssistant class.
            ta.PrintGrades();

            // The following does work.
            IStudent student = ta;

            student.PrintGrades();
        }
Exemple #2
0
        static void Main(string[] args)
        {
//            Console.WriteLine("Hello World!");
            TeachingAssistant ta       = new TeachingAssistant();
            IStudent          iStudent = new TeachingAssistant4();

            // The following causes a design time error for the
            // TeachingAssistant4 class but not the TeachingAssistant class.
            ta.PrintGrades();

            iStudent.PrintGrades();
            // The following does work.
            IStudent student = ta;

            student.PrintGrades();
        }