Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace EnderDeath
- {
- class EnderCat : Entity
- {
- public void Meow()
- {
- Console.WriteLine("M. EOW.");
- }
- public override void Damage(int dam)
- {
- base.Damage(dam);
- Meow();
- }
- public override void Kick()
- {
- Damage(1);
- }
- }
- class Entity
- {
- public int Health = 100;
- public bool IsAlive = true;
- public virtual void Damage(int dam)
- {
- if(Health < 1)
- throw new RuntimeException("You cannot kill dead entities.");
- Health -= dam;
- if(Health < 0)
- {
- Health = 0
- IsAlive = false;
- }
- }
- }
- public class Program
- {
- public static void Main(string[] args)
- {
- EnderCat EvilKitteh = new EnderCat();
- for(int i=100;i > 5;i++)
- {
- EvilKitteh.Kick();
- }
- Console.WriteLine("Shaddap ya darn cat!");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement