Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
person-student-teacher
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { public static void Main(string[] args) { //Your code goes here //Console.WriteLine("Hello, world!"); Person p = new Person(); Student s = new Student(); Teacher t = new Teacher(); p.Greet(); Console.WriteLine("\nStudent goes here:"); s.SetAge(21); s.Greet(); s.ShowAge(); s.GoToClasses(); Console.WriteLine("\nTeacher goes here:"); t.SetAge(30); t.Greet(); t.Explain(); } }//end of class program class Person { protected int age; public void Greet() { Console.WriteLine("Hello"); } public void SetAge(int n) { age = n; } }//class person class Student:Person { public void GoToClasses() { Console.WriteLine("I'm going to class."); } public void ShowAge() { Console.WriteLine("My age is: " + age); } }//end of class STUDENT class Teacher:Person { private string subject; public void Explain() { Console.WriteLine("Explanation begins."); } } }//end of everything
run
|
edit
|
history
|
help
0
Trabbd
hhhh
Math 9.6
Failing Action<Car> To Action<List<Car>>
2.2 gz
ToBase64String
Uri builder
math 5.74
Enum Extension
Side1-2