Skip to content

Instantly share code, notes, and snippets.

@YannMjl
Last active June 11, 2018 15:20
Show Gist options
  • Save YannMjl/3e8bafbc497ea8d79c058badd482b362 to your computer and use it in GitHub Desktop.
Save YannMjl/3e8bafbc497ea8d79c058badd482b362 to your computer and use it in GitHub Desktop.
Inheritance example c#
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