Last active
June 7, 2019 16:07
-
-
Save xray/98403e02bc26132fb54f608b38f6093b to your computer and use it in GitHub Desktop.
An example of inheritance in 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; | |
public class Dog | |
{ | |
public void Bark() | |
{ | |
Console.WriteLine("Woof"); | |
} | |
} | |
public class BassetHound : Dog | |
{ | |
public void Smell() | |
{ | |
Console.WriteLine("Sniff sniff..."); | |
} | |
} | |
var flash = new Hound(); | |
flash.Bark(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment