Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- public abstract class Animal
- {
- private int weight;
- private String sound;
- public int Weight { get { return weight; } set { weight = value; } }
- public String Sound { get { return sound; } set { sound = value; } }
- public Animal(int Value)
- {
- this.Weight = Value;
- }
- String says()
- {
- return Sound;
- }
- }
- public class Cow : Animal
- {
- public Cow(int Value)
- {
- this.Weight = Value;
- }
- String says()
- {
- return Sound = "Mooo";
- }
- }
- public class Snake : Animal
- {
- public Snake(int Value)
- {
- this.Weight = Value;
- }
- String says()
- {
- return Sound = "Shhh";
- }
- }
- public class Pig : Animal
- {
- public Pig(int Value)
- {
- this.Weight = Value;
- }
- String says()
- {
- return Sound = "Oink";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement