Last active
June 11, 2018 15:20
-
-
Save YannMjl/3e8bafbc497ea8d79c058badd482b362 to your computer and use it in GitHub Desktop.
Inheritance example c#
This file contains 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
using System; | |
namespace InheritanceExample | |
{ | |
public class humanBeing | |
{ | |
public humanBeing() | |
{ | |
Console.WriteLine("Calling the human being class constructor"); | |
} | |
public void Display() | |
{ | |
Console.WriteLine("I'm a human being"); | |
} | |
} | |
public class Man:humanBeing | |
{ | |
public Man() | |
{ | |
Console.WriteLine("I'm a man, a male human being"); | |
} | |
} | |
public class Program | |
{ | |
static void Main(string[] args) | |
{ | |
Man yann = new Man(); | |
yann.Display(); | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment