Advertisement
KodingKid

C# Polymorphism: Gun Edition (boom)

Apr 17th, 2021
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.42 KB | None | 0 0
  1. class Firearm
  2. {
  3.     public void gunFire()
  4.     {
  5.         Console.WriteLine("Boom")
  6.         }
  7. }
  8. class Gun1 : Firearm
  9. {
  10. public void gunFire()
  11.     {
  12.         Console.WriteLine("Boom")
  13.         }
  14. }
  15. class Gun2 : Firearm
  16. {
  17. public void gunFire()
  18.     {
  19.         Console.WriteLine("Boom-Bang")
  20.         }
  21. }
  22. class Gun3 : Firearm
  23. {
  24. public void gunFire()
  25.     {
  26.         Console.WriteLine("Boom-Bang-Pow")
  27.         }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement