public void CrocodileCanInheritSleep() { Crocodile croc = new Crocodile("large", true, 4, "green"); string result = croc.Sleep(); Assert.Equal("I sleep when I'm cold because I'm cold blooded", result); }
public static void Main(string[] args) { Console.WriteLine("*************************** Toy ***************************************"); var babyCube = new BabyCube(10, "VTech"); babyCube.Describe(); babyCube.SetLevel(1); Console.WriteLine("*************************** Birds ***************************************"); //Birds (the parent constructor was executed first before the child constructor) var goose = new Goose(true, 2, "seeds", "gray"); Console.WriteLine("*************************** Pets ***************************************"); //Pets(child can have its own methods Bark or Climb) var puppy = new Puppy(false, 4, "bones", "yellow"); puppy.Bark(); Console.WriteLine("---------------------------------"); var kitty = new Kitty(false, 4, "fish", "yellow"); kitty.Climb(); Console.WriteLine("*************************** Crawls ***************************************"); //Crawls(child can use its implemented interface methods and call the parent public methods) var turtle = new Turtle(false, 4, "insects", "brown"); turtle.Crawl(); turtle.Eat(); //turtle.Confidential(); turtle.MakePublic(); Console.WriteLine("---------------------------------"); var crocodile = new Crocodile(false, 4, "fish", "gray"); crocodile.Sleep(); crocodile.Crawl(); Console.WriteLine("---------------------------------"); var tortoise = new Tortoise(true, 4, "grass", "gray"); tortoise.Sleep(); tortoise.Crawl(); tortoise.Walk(); }
static void Main(string[] args) { Crocodile crocodile = new Crocodile("large", true, 4, "green"); Horse horse = new Horse(6, true, 8, "yellow"); GrizzlyBear grizzly = new GrizzlyBear(true, 1000, 6, "brown", true); Lion lion = new Lion(true, 8, 3, "tan", true); Sloth sloth = new Sloth(500, "slow", 10, "grey"); Snake cobra = new Snake(11, "highly venomous", 3, "black"); crocodile.Sleep(); grizzly.Sleep(); horse.Sweat(); lion.Sweat(); }
public void CrocodileCanSleep() { Crocodile crocodile = new Crocodile(); Assert.Equal("ZZZ... ZZZ... ZZZ...", crocodile.Sleep()); }