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", "D256"); Console.WriteLine("Teacher = " + teacher.ToString()); student.PersonMethod(); }
static void Main(string[] args) { Person somebody = new Person(); somebody.FirstName = "Joe"; somebody.LastName = "Dirt"; somebody.Address = "Unknown"; somebody.Age = 29; somebody.PhoneNumber = "040-2424234324324"; Console.WriteLine(somebody.ToString()); Teacher teacher = new Teacher(); teacher.FirstName = "Jani"; teacher.LastName = "Immonen"; teacher.Address = "Koding"; teacher.Age = 21; teacher.PhoneNumber = "Unknown"; teacher.Room = "D330"; Console.WriteLine(teacher.ToString()); Student theStudent = new Student("Pekka", "Pouta", "J23432432432"); theStudent.Address = "Kilju 3"; theStudent.Age = 39; theStudent.PhoneNumber = "23432432432324"; Console.WriteLine(theStudent.ToString()); somebody.PersonMethod(); teacher.PersonMethod(); teacher.TeacherMethod(); theStudent.PersonMethod(); theStudent.StudentMethod(); Console.ReadLine(); }
static void Main(string[] args) { Person somebody = new Person(); somebody.FirstName = "John"; somebody.LastName = "Unknown"; somebody.Address = "Unknown"; somebody.Age = 29; somebody.PhoneNumber = "123-123456"; Console.WriteLine(somebody.ToString()); Teacher teacher = new Teacher(); teacher.FirstName = "Ope"; teacher.LastName = "Opettaja"; teacher.Address = "Koulukatu"; teacher.Age = 35; teacher.PhoneNumber = "090-098765"; teacher.Room = "1"; Console.WriteLine(teacher.ToString()); Student student = new Student("Olli","Opiskelija","S1234"); student.Address = "Koulukatu2"; student.Age = 30; student.PhoneNumber = "040-4756438"; Console.WriteLine(student.ToString()); somebody.PersonMethod(); teacher.PersonMethod(); teacher.TeacherMethod(); student.PersonMethod(); student.StudentMethod(); Console.ReadLine(); }
static void Main(string[] args) { Person somebody = new Person(); somebody.FirstName = "Joe"; somebody.LastName = "Dirt"; somebody.Address = "Unknown"; somebody.Age = 25; somebody.PhoneNumber = "0500 123456789"; Console.WriteLine(somebody.ToString()); Teacher teacher = new Teacher(); teacher.FirstName = "Rape"; teacher.LastName = "Ström"; teacher.Address = "Unknown"; teacher.Age = 69; teacher.PhoneNumber = "Unknown"; Console.WriteLine(teacher.ToString()); Student theStudent = new Student("Pekka", "Pouta", "666 999"); theStudent.Address = "Kilju 3"; theStudent.Age = 15; theStudent.PhoneNumber = "12345678555559"; Console.WriteLine(theStudent.ToString()); somebody.PersonMethod(); teacher.PersonMethod(); teacher.TeacherMethod(); theStudent.PersonMethod(); theStudent.StudentMethod(); // no no no //teacher.StudentMethod(); //theStudent.TeacherMethod(); }
static void Main(string[] args) { //luo opiskelija Student student = new Student("Kirsi", "Kernel", "Piippukatu 2", "K8922"); Console.WriteLine("Student = " + student.ToString()); student.StudentMethod(); student.PersonMethod(); //luo opettaja Teacher teacher = new Teacher("Teppo", "Terävä", "kielokuja 7", "D566"); Console.WriteLine("Teacher = " + teacher.ToString()); teacher.TeacherMethod(); teacher.PersonMethod(); }
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(); // monimuotoisuus eli polymophismi // Person person = new Teacher(); }
static void Main(string[] args) { // create on student object Student student = new Student("Kirsi", "Kernel", "Piippukatu 2","K2314"); Console.WriteLine("Student = " + student.ToString()); student.StudentMethod(); student.PersonMethod(); Teacher teacher = new Teacher("Teppo", "Teräsmies", "Katupiippu 2", "D556"); Console.WriteLine("Teacher = " + teacher.ToString()); teacher.TeacherMethod(); teacher.PersonMethod(); // Monimuotoisuus Person person = new Teacher(); }
static void Main(string[] args) { // create one person Person person = new Person(); person.FirstName = "Kirsi"; person.LastName = "Kernel"; person.Address = "torikatu 1"; person.Age = 30; person.PhoneNumber = "020-12345678"; Console.WriteLine(person.ToString()); // create one teacher Teacher teacher = new Teacher(); teacher.FirstName = "Teppo"; teacher.LastName = "Konsoli"; teacher.Address = "piippukatu 2"; teacher.Age = 40; teacher.PhoneNumber = "010-12345678"; teacher.Room = "D100"; Console.WriteLine(teacher.ToString()); // create one student Student student = new Student("Minna", "Husso", "J9090"); student.Address = "kilju 3"; student.Age = 20; student.PhoneNumber = "040-12345678"; Console.WriteLine(student.ToString()); // do something methods person.PersonMethod(); // This method belongs to Person! teacher.PersonMethod(); // This method belongs to Person! teacher.TeacherMethod(); // This method belongs to Teacher! student.PersonMethod(); // This method belongs to Person! student.StudentMethod(); // This method belongs to Student! Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { // create a one Person object Person person = new Person(); person.FirstName = "Kirsi"; person.LastName = "Kernel"; person.Address = "torikatu 1"; person.Age = 30; person.PhoneNumber = "020-12345678"; Console.WriteLine(person.ToString()); // create a one Teacher Object Teacher teacher = new Teacher(); teacher.FirstName = "Teppo"; teacher.LastName = "Konsoli"; teacher.Address = "piippukatu 2"; teacher.Age = 40; teacher.PhoneNumber = "010-12345678"; teacher.Room = "D100"; Console.WriteLine(teacher.ToString()); // create a one Student object with parametric constuctor Student student = new Student("Minna", "Husso", "J9090"); student.Address = "kilju 3"; student.Age = 20; student.PhoneNumber = "040-12345678"; Console.WriteLine(student.ToString()); // do something methods person.PersonMethod(); // This method belongs to Person! teacher.PersonMethod(); // This method belongs to Person! (derived class can use it!) teacher.TeacherMethod(); // This method belongs to Teacher! student.PersonMethod(); // This method belongs to Person! (derived class can use it!) student.StudentMethod(); // This method belongs to Student! }
static void Main(string[] args) { // yliluokan olio //Person person = new Person(); //person.FirstName = "Pete"; //person.LastName = "Kauppine"; //person.Address = "kiuru vesi"; //person.Age = 53; //person.PhoneNumber = "123-4567890"; //Console.WriteLine(person.ToString()); // create one Student object Student student = new Student(); student.FirstName = "Joonas"; student.LastName = "Mankinen"; student.Address = "Essokatu 3"; student.Age = 22; student.PhoneNumber = "123-4567890"; student.StudentID = "K1554"; Console.WriteLine(student.ToString()); // create one Teacher method Teacher teacher = new Teacher("Joni", "Johtaja", "D666"); teacher.Address = "Hiisikuja 4"; teacher.Age = 22; teacher.PhoneNumber = "666-6666666"; Console.WriteLine(teacher.ToString()); // do something methods teacher.TeacherMethod(); student.StudentMethod(); student.PersonMethod(); }