コード例 #1
0
ファイル: Program.cs プロジェクト: K1801/Demo04
        static void Main(string[] args)
        {
            // Create one student object
            Student student = new Student("Kirsi", "Kernel", "Piippukatu 2", "K8990");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            Teacher teacher = new Teacher("Teppo", "Terävä", "Kielokuja 2", "D566");
            Console.WriteLine("Teacher = " + teacher.ToString());
            teacher.TeacherMethod();
            teacher.PersonMethod();
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: rikukal/Demo04
        static void Main(string[] args)
        {
            // create one student object
            Student student = new Student("Kirsi","Kernel","Piippukatu 2","K8989");
            Console.WriteLine("Student = " + student.ToString());
            student.StudentMethod();
            student.PersonMethod();

            Teacher teacher = new Teacher("Teppo", "Terävä", "Kielokuja 2", "D566");
            Console.WriteLine("Teacher = " + teacher.ToString());
            teacher.TeacherMethod();
            teacher.PersonMethod();
            
            // mahdollista olion ottaa aliluokan kutsu
            // Person person = new Teacher

        }
コード例 #3
0
        static void Main(string[] args)
        {
            Person henkilo = new Person();

            henkilo.FirstName   = "Pekka";
            henkilo.LastName    = "Pouta";
            henkilo.Address     = "Pilvilinna";
            henkilo.Age         = 69;
            henkilo.PhoneNumber = "0404040404";
            Console.WriteLine(henkilo.ToString());

            Console.WriteLine("===========================");

            Teacher ope = new Teacher();

            ope.FirstName   = "Lorppa";
            ope.LastName    = "Huuli";
            ope.Address     = "Lorppakatu";
            ope.Age         = 31;
            ope.PhoneNumber = "000000000000";
            ope.Room        = "D123";
            Console.WriteLine(ope.ToString());

            Console.WriteLine("===========================");

            Student opiskelija = new Student("hei", "hou", "m1234");

            opiskelija.Address     = "let's go";
            opiskelija.Age         = 20;
            opiskelija.PhoneNumber = "1234242";
            Console.WriteLine(opiskelija.ToString());

            henkilo.PersonMethod();
            ope.PersonMethod();
            ope.TeacherMethod();
            opiskelija.PersonMethod();
            opiskelija.StudentMethod();
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: VilleBulq/Demo04
        static void Main(string[] args)
        {
            // Person person = new Person();
            // person.Firstname = "Jaska";
            // create pone student object
            Student student = new Student();

            student.Firstname   = "Niko";
            student.LastName    = "Mankinen";
            student.PhoneNumber = "696969696";
            student.Address     = "Dynamo 2";
            student.Age         = 23;
            student.StudentID   = "K1532";
            student.StudentMethod();
            Console.WriteLine(student.ToString());

            Teacher teacher = new Teacher("Kirsi", "Kernel", "D5560");

            teacher.Address     = "Piippukatu 2";
            teacher.PhoneNumber = "04429666";
            Console.WriteLine(teacher.ToString());
            student.PersonMethod();
        }