Created
November 24, 2017 05:54
-
-
Save markrowi/576552849d43970b39a5467db14c663c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //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!"); | |
| Man roo = new Man("roo"); | |
| Woman mey = new Woman("mey"); | |
| Console.WriteLine(roo.getName()); | |
| Console.WriteLine(getGender(mey)); | |
| } | |
| public static string getGender(Human h){ | |
| return h.getGender(); | |
| } | |
| } | |
| public class Human{ | |
| public string color = ""; | |
| public string gender = ""; | |
| public Human(){ | |
| this.color = ""; | |
| } | |
| public string getGender(){ | |
| return this.gender; | |
| } | |
| } | |
| public class Man : Human{ | |
| private string name = ""; | |
| public Man(string name){ | |
| this.name = name; | |
| this.gender = "male"; | |
| } | |
| public string getName(){ | |
| return this.name; | |
| } | |
| } | |
| public class Woman : Human{ | |
| private string name = ""; | |
| public Woman(string name){ | |
| this.name = name; | |
| this.gender = "female"; | |
| } | |
| public string getName(){ | |
| return this.name; | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment