Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //no animal class, inheritance not important now
- public class Dog{
- string name;
- void MakeSound()
- {
- Console.WriteLine("Bark bark");
- }
- }
- public class Duck{
- string name;
- void MakeSound()
- {
- Console.WriteLine("Quack quack");
- }
- }
- public class Cow{
- string name;
- void MakeSound()
- {
- Console.WriteLine("Moo moo");
- }
- }
- public static void Main(string[] args)
- {
- Dog dog = new Dog("Dogy");
- dog.MakeSound();
- Duck duck = new Duck("Ducky");
- duck.MakeSound();
- Coew cow = new Cow("Cowy");
- cow.MakeSound();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement