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) { 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 person = new Person(); Teacher teacher = new Teacher(); teacher.FirstName = "Kirsi"; teacher.LastName = "Kernel"; teacher.Age = 30; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "032-0303030"; teacher.Room = "D345"; Console.WriteLine("---------------------------------------------"); Console.WriteLine(teacher.ToString()); teacher.TeacherMethod(); Student student = new Student("Korianteri", "Ruusunnuppu", "K999"); student.Age = 20; student.PhoneNumber = "040-404040"; student.Address = "Yliopstinkatu 1"; Console.WriteLine("---------------------------------------------"); Console.WriteLine(student.ToString()); student.StudentMethod(); Console.WriteLine("---------------------------------------------"); }
static void Main(string[] args) { //Person person = new person(); //create one teacher from Teacher class Teacher teacher = new Teacher(); teacher.Firstname = "Kirsi"; teacher.Lastname = "Kernel"; teacher.Age = 30; teacher.Address = "piippukatu 2"; teacher.Phonenumber = "0202300303"; teacher.Room = "D444"; Console.WriteLine(teacher.ToString()); Student student = new Student("Matti", "Mallikas", "H9900"); student.Address = "Kirkkokatu 10"; student.Age = 20; student.Phonenumber = "3030303"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { Person person = new Person(); person.FirstName = "Kimmo"; person.LastName = "Oinonen"; person.Address = "Minna Canthin katu"; person.Age = 21; person.PhoneNumber = "0407298087"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Jussi", "Konsoli", "D456"); teacher.Address = "Piippukatu 2"; teacher.Age = 55; teacher.PhoneNumber = "0401234567"; Console.WriteLine(teacher.ToString()); Student student = new Student("Olli", "Opiskelija", "K1744"); student.Age = 20; student.Address = "Koulukatu 10"; student.PhoneNumber = "0409876543"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { Person person = new Person("Joni", "Maisema"); person.Age = 15; person.Address = "Kompurointikuja 609"; person.PhoneNumber = "040-1234567"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("John", "Cena", "D330"); teacher.Age = 38; teacher.Address = "Unknown"; Console.WriteLine(teacher.ToString()); Student student = new Student(); student.FirstName = "Kalle"; student.LastName = "Tanttu"; student.Age = 21; student.Address = "Kyminkatu 1"; Console.WriteLine(student.ToString()); person.PersonMethod(); teacher.TeacherMethod(); student.StudentMethod(); // NotLikeThis //person.StudentMethod(); //student.TeacherMethod(); }
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) { //create one student object Student student = new Student(); student.Firstname = "Seppo"; student.Lastname = "Terävä"; student.Address = "Kusipolku 1"; student.Age = 24; student.PhoneNumber = "050 4040303030303"; student.StudentID = "k1977"; Console.WriteLine(student.ToString()); Teacher teacher = new Teacher("kirsi", "kernel", "D666"); teacher.Age = 35; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "404040404"; Console.WriteLine(teacher.ToString()); teacher.TeahcerMethod(); student.StudentMethod(); //Olio ei ole aliluokan sisällä //student.PersonMethod(); }
static void Main(string[] args) { // create a one Person object Student student = new Student(); student.FirstName = "Teppo"; student.LastName = "Terava"; student.Address = "Piippukatu 3"; student.Age = 25; student.PhoneNumber = "040 55050150"; student.StudentID = "K2341"; Console.WriteLine(student.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()); teacher.TeacherMethod(); student.StudentMethod(); // olio ei ole aliluokan sisalla... }
static void Main(string[] args) { // Person person = new Person(); Tätä ei yleensä tehdä, koska ajatuksena juuri oli luoda aliluokkia. Harvemmin käytetään pääluokkaa oliona //luodaan teacher olio Teacher teacher = new Teacher(); teacher.FirstName = "Kirsi"; teacher.LastName = "Kernel"; teacher.Age = 30; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "+345000"; teacher.Room = "D345"; Console.WriteLine(teacher.ToString()); Student student = new Student("Matti", "Mattinen", "M93"); student.Address = "Kirsikkakuja 18"; student.Age = 25; student.PhoneNumber = "+54 0387"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { // Person person = new Person(); //create one teacher from Teacher class Teacher teacher = new Teacher(); teacher.FirstName = "Kirsi"; teacher.LastName = "Kernel"; teacher.Age = 30; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "010-123456789"; teacher.Room = "D444"; Console.WriteLine(teacher.ToString()); Student student = new Student("Matti", "Mallikas", "H9090"); student.Address = "Kirkkokatu 10"; student.Age = 20; student.PhoneNumber = "040-032198765"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { Person person = new Person(); person.FirstName = "Viljo"; person.LastName = "Viljanen"; person.Age = 75; person.Address = "Katukatu 47"; person.PhoneNumber = "04012341235"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Jussi", "Konsoli", "D456"); teacher.Address = "Tietie 23"; teacher.Age = 45; teacher.PhoneNumber = "044333124652"; Console.WriteLine(teacher.ToString()); Student student = new Student("Matti", "Meikäläinen", "K1111"); student.Address = "Kujakuja 33"; student.Age = 25; student.PhoneNumber = "0502221335"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { Person person = new Person(); person.FirstName = "Kirsi"; person.LastName = "Kernel"; person.Age = 35; person.Address = "Piippukatu 2"; person.PhoneNumber = "02012345678"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Jussi", "Konsoli", "D456"); teacher.Address = "Piippukatu 1"; teacher.Age = 40; teacher.PhoneNumber = "010-87654321"; Console.WriteLine(teacher.ToString()); Student student = new Student("Jouko", "Koodari", "K1234"); student.Address = "Ceesharpkatu 3"; student.Age = 24; student.PhoneNumber = "030132654789"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { // Person person = new Person(); //create one teacher Teacher teacher = new Teacher(); teacher.Firstname = "kirsi"; teacher.Lastname = "kernel"; teacher.Age = 30; teacher.Address = " piippukatu 2"; teacher.Phonenumber = "101-4567894"; teacher.Room = "D444"; Console.WriteLine(teacher.ToString()); Student student = new Student("Matti", "mallikas", "H7982"); student.Address = "kirkkokatu 72"; student.Age = 23; student.Phonenumber = "121-4567892"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { Person person = new Person(); person.FirstName = "Kirsi"; person.LastName = "Kernel"; person.Age = 35; person.Address = "Piippukatu "; person.PhoneNumber = "02012345678"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Jussi", "Konsoli", "D456"); teacher.Address = "Piippukatu 1"; teacher.Age = 40; teacher.PhoneNumber = "010-87654321"; Console.WriteLine(teacher.ToString()); Student student = new Student("Jape", "Joystick", "K2915"); student.Address = "Alkmdsakatu 13"; student.Age = 20; student.PhoneNumber = "040-52185482"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { Person person = new Person(); person.FirstName = "Ossi"; person.LastName = "Kuningas"; person.Age = 24; person.Address = "Siltakatu 18 A 23"; person.PhoneNumber = "0700123123"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Pekka", "Jalmari", "D619"); teacher.Address = "Sillanalla 69"; teacher.Age = 69; teacher.PhoneNumber = "0700456456"; Console.WriteLine(teacher.ToString()); Student student = new Student("Timo", "Pelle", "K2329"); student.Address = "Pekkalantie 14"; student.Age = 33; student.PhoneNumber = "0405093917"; Console.WriteLine(student.ToString()); Console.WriteLine("Press any key to continue..."); Console.ReadLine(); }
static void Main(string[] args) { Student student = new Student("Kirsi","Kernel","Piippukatu 2","K1698"); Console.WriteLine("Student = " + student.ToString()); Teacher teacher = new Teacher("Pasi", "Manninen", "Piippukatu 2", "D426"); Console.WriteLine("Teacher = " + teacher.ToString()); }
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 person = new Person(); person.FirstName = "Ari"; person.LastName = "Vataja"; person.Address = "Jyvaskyla"; person.Age = 24; person.PhoneNumber = "040234234"; Console.WriteLine(person.ToString()); Teacher jani = new Teacher("Jani", "Immonen", "unavailable"); jani.Address = "Kuokkalan silta"; jani.Age = 24; Console.WriteLine(jani.ToString()); Student pekka = new Student("Pekka", "Routa", "K123213"); pekka.Address = "Opiskelijakuja 23"; pekka.Age = 23; pekka.StudentID = "K4352"; Console.WriteLine(pekka.ToString()); //Person somebody = new Student("test", "testing", "ID"); //Console.WriteLine(somebody.ToString()); List <Person> people = new List <Person>(); for (int i = 0; i < 20; i++) { if (i < 5) { people.Add(new Person()); } else if (i < 12) { people.Add(new Teacher()); } else { people.Add(new Student()); } } foreach (Person personnel in people) { Console.WriteLine(people.ToString()); } }
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 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 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) { Person person = new Person(); person.FirstName = "Sampo"; person.LastName = "Immo"; person.Address = "Jyväskylä"; person.Age = 24; person.PhoneNumber = "040-1234567"; Console.WriteLine(person.ToString()); Teacher jani = new Teacher("Jani", "Immonen", "unavailable"); jani.Address = "Kuokkalan silta 1"; jani.Age = 24; Console.WriteLine(jani.ToString()); Student pekka = new Student("Pekka", "Pouta", "K2390"); pekka.Address = "Opiskelijakuja 69"; pekka.Age = 19; Console.WriteLine(pekka.ToString()); List <Person> people = new List <Person>(); for (int i = 0; i < 20; i++) { if (i < 5) { people.Add(new Person()); } else if (i < 12) { people.Add(new Teacher()); } else { people.Add(new Student()); } people.Add(new Person()); } foreach (Person personInPeople in people) { Console.WriteLine(personInPeople.ToString()); } }
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) { // create one student object Student student = new Student(); student.Firstname = "Teppo"; student.Lastname = "Terävä"; student.Address = "piippukatu 3"; student.Age = 24; student.PhoneNumber = "010-123456"; student.StudentID = "G2323"; Console.WriteLine(student.ToString()); Teacher teacher = new Teacher("Kirsi", "Kernel", "D566"); teacher.Age = 35; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "010-987654"; Console.WriteLine(teacher.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { Person person = new Person("Veera", "Karhinen"); person.Age = 19; person.Address = "Vehkakatu 12"; person.PhoneNumber = "050 123 4567"; Console.WriteLine(person.ToString()); Teacher teacher = new Teacher("Pasi", "Manninen", "D530"); teacher.Address = "Piippukatu 1"; teacher.Age = 40; teacher.PhoneNumber = "010 765 4321"; Console.WriteLine(teacher.ToString()); Student student = new Student("Veeti", "Karttunen", "K1565"); student.Age = 20; student.Address = "Vehkakatu 12"; student.PhoneNumber = "050 234 5678"; Console.WriteLine(student.ToString()); Console.WriteLine("Press enter to continue..."); Console.Read(); }
static void Main(string[] args) { // create one teacher from Teacher class Teacher teacher = new Teacher(); teacher.FirstName = "Kirsi"; teacher.LastName = "Kernel"; teacher.Age = 30; teacher.Address = "Piippukatu 2"; teacher.PhoneNumber = "010-12345678"; teacher.Room = "D444"; Console.WriteLine(teacher.ToString()); Student student = new Student("Minna", "Husso", "J9090"); student.Address = "Kirkkokatu 10"; student.Age = 20; student.PhoneNumber = "040-1234567"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); }
static void Main(string[] args) { //create one teacher from Teacher class Teacher teacher = new Teacher(); teacher.Firstname = "Kirsi"; teacher.Lastname = "Kernel"; teacher.Age = 30; teacher.Address = "Piippukatu2 "; teacher.PhoneNumber = "010-12345678"; teacher.Room = "D444"; Console.WriteLine(teacher.ToString()); Student student = new Student("Timo", "Koljonen", "K11421"); student.Age = 49; student.PhoneNumber = "044-63453243"; Console.WriteLine(student.ToString()); teacher.TeacherMethod(); student.StudentMethod(); Console.ReadLine(); }
static void Main(string[] args) { Person somebody = new Person(); somebody.FirstName = "Noppa"; somebody.LastName = "Nipples"; somebody.Address = "twitch.tv"; somebody.Age = 10; somebody.PhoneNumber = "112"; Console.WriteLine(somebody.ToString()); Teacher teacher = new Teacher(); teacher.FirstName = "Dendi"; teacher.LastName = "PugeRU"; teacher.Address = "Dota2"; teacher.Age = 24; teacher.PhoneNumber = "19-0-32"; teacher.Room = "BottomLane"; Console.WriteLine(teacher.ToString()); Student theStudent = new Student("Dr", "Pepper", "9001"); theStudent.Address = "olutta"; theStudent.Age = 10; theStudent.PhoneNumber = "93865310"; Console.WriteLine(theStudent.ToString()); somebody.PersonMethod(); teacher.TeacherMethod(); theStudent.StudentMethod(); Console.ReadLine(); }
static void Main(string[] args) { // Create one teacher from Teacher class Teacher ope = new Teacher(); ope.FirstName = "Hissi"; ope.LastName = "Hilleri"; ope.Address = "Valtukunnankatu 15"; ope.Age = 55; ope.PhoneNumber = "010-5557771"; ope.Room = "229"; Console.WriteLine(ope.ToString()); // Create one Student from Student class Student oppilas = new Student("Kalle", "Kakkahousu", "K4KK4"); oppilas.Address = "Housunkuja 2"; oppilas.Age = 3; oppilas.PhoneNumber = "444-44444444"; Console.WriteLine(oppilas.ToString()); ope.TeacherMethod(); oppilas.StudentMethod(); }
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(); }
static void Main(string[] args) { // Person person = new Person(); Teacher teacher = new Teacher(); teacher.FirstName = "Taneli"; teacher.LastName = "Sormustin"; teacher.Room = "D220"; teacher.Address = "Jyväskylä Piippukatu 2"; teacher.PhoneNumber = "050-1234567"; teacher.Age = 20; Console.WriteLine(teacher.ToString()); teacher.TeacherMethod(); Console.WriteLine(); Student student = new Student("Late", "Gee", "K1337"); student.PhoneNumber = "010-22233344"; student.Age = 12; student.Address = "Roskis"; Console.WriteLine(student.ToString()); student.StudentMethod(); Console.WriteLine(); }