Skip to content

Instantly share code, notes, and snippets.

@nanwang2016
Created August 12, 2020 16:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nanwang2016/b543e382c8ba15bddfdd7f3277b4642b to your computer and use it in GitHub Desktop.
Save nanwang2016/b543e382c8ba15bddfdd7f3277b4642b to your computer and use it in GitHub Desktop.
using System;
namespace TestFile
{
class Program
{
static void Main(string[] args)
{
}
}
class Animal //Based Class or Parent Class
{
public virtual void Eat()
{
Console.WriteLine("The animal eats food!");
}
}
class Dog:Animal
{
public override void Eat()
{
Console.WriteLine("The dog eats bone!");
}
}
class Cat:Animal
{
public override void Eat()
{
Console.WriteLine("The cat eats fish!");
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment