Created
August 12, 2020 16:15
-
-
Save nanwang2016/b543e382c8ba15bddfdd7f3277b4642b to your computer and use it in GitHub Desktop.
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 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