Advertisement
m1dnight

Untitled

Jan 3rd, 2014
302
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. using System;
  2. using Microsoft.CSharp.RuntimeBinder.Binder;
  3.  
  4. namespace POOLProject
  5. {
  6. public class Duck
  7. {
  8. public void Quack ()
  9. {
  10. Console.WriteLine ("Duck quaks *quack quack*");
  11. }
  12. }
  13. public class SillyDog
  14. {
  15. public void Quack ()
  16. {
  17. Console.WriteLine("Dog quacks *woof woof*");
  18. }
  19. }
  20.  
  21. class MainClass
  22. {
  23. public static void Main (string[] args)
  24. {
  25. Duck d1 = new Duck();
  26. Duck d2 = new Duck();
  27. SillyDog d3 = new SillyDog();
  28.  
  29. MakeSound(d1);
  30. MakeSound(d2);
  31. MakeSound(d3);
  32.  
  33. }
  34. public static void MakeSound(dynamic obj)
  35. {
  36. obj.Quack();
  37. }
  38. }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement