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
Delegaty Func
Doubt-" 1 parameter Gen _Derive_Class inherit the 2 parameter Gen_Base_Class"
Hello World Sub
asdf
How to count the occurrence of each character in a string?
sdfrgthyjhtgrfedcd
XML filtering example
equation with a variable on the 2nd power
EDFCSCSA V
Test Daylight Savings