Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using Microsoft.CSharp.RuntimeBinder.Binder;
- namespace POOLProject
- {
- public class Duck
- {
- public void Quack ()
- {
- Console.WriteLine ("Duck quaks *quack quack*");
- }
- }
- public class SillyDog
- {
- public void Quack ()
- {
- Console.WriteLine("Dog quacks *woof woof*");
- }
- }
- class MainClass
- {
- public static void Main (string[] args)
- {
- Duck d1 = new Duck();
- Duck d2 = new Duck();
- SillyDog d3 = new SillyDog();
- MakeSound(d1);
- MakeSound(d2);
- MakeSound(d3);
- }
- public static void MakeSound(dynamic obj)
- {
- obj.Quack();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement