static void Main(string[] args) { var velociraptor = new Velociraptor("Brown", "Small"); var triceratops = new Triceratops(); var dinoHandler = new DinoHandler(); var forklift = new Forklift(); }
static void AbstractDemo() { TRex myTrex = new TRex(); Triceratops myTriceratops = new Triceratops(); myTrex.EatFood(); myTrex.Move(); myTrex.Sleeps(); myTrex.Communicates(); myTrex.SkinType(); myTrex.Teeth(); Console.WriteLine(" "); myTriceratops.EatFood(); // has not been overwritten so "the dinosaur moves" myTriceratops.Move(); myTriceratops.Sleeps(); myTriceratops.Communicates(); myTriceratops.SkinType(); myTriceratops.Teeth(); Console.WriteLine(" "); Teradactyl myTeradactyl = new Teradactyl(); myTeradactyl.EatFood(); myTeradactyl.Move(); myTeradactyl.Sleeps(); myTeradactyl.Communicates(); myTeradactyl.Teeth(); myTeradactyl.SkinType(); }
static void Main(string[] args) { Triceratops triceratops = new Triceratops(); var child = ChildCreator.CreateChild(new TriceratopsToMammalAdapter(triceratops)); child.Cry(); }
static void AbstractDemo() { TRex trex = new TRex(); Triceratops tri = new Triceratops(); Archaeopteryx arc = new Archaeopteryx(); NarratorLizard nl = new NarratorLizard(); }
public static void AdapterExample() { var triceratops = new Triceratops(); var child = ChildCreator.CreateChild(new TriceratopsToMammalAdapter(triceratops)); child.Cry(); }
public void Triceratops_Da_Hijo_Como_Mamifero_Y_Llora() { var triceratops = new Triceratops(); var triceratops_adaptado = new TriceratopsAMamiferoAdapter(triceratops); var hijo = CreadorDeHijo.CrearHijo(triceratops_adaptado); Assert.AreEqual("TRICERATOPS ESTA LLORANDO", hijo.Llorar()); }
static void AbstractDemo() { TRex trex = new TRex(); Triceratops triceratops = new Triceratops(); trex.EatFood(); trex.Move(); trex.SkinType(); triceratops.EatFood(); triceratops.Move(); triceratops.Teeth(); }
static void AbstractDemo() { Trex trex = new Trex(); Triceratops triceratops = new Triceratops(); trex.EatFood(); trex.Move(); trex.Speed(); trex.Habitat(); triceratops.EatFood(); triceratops.Move(); triceratops.Speed(); triceratops.Habitat(); }
static void Main(string[] args) { var utahraptor = new Utahraptor(); var triceratops = new Triceratops(); var stygimoloch = new Stygimoloch(); var stegosaurus = new Stegosaurus(); var dinos = new DinoBase[] { utahraptor, triceratops, stegosaurus, stygimoloch }; var boxer = new Boxer(); var rotweiler = new Rotweiler(); var chihuahua = new Chihuahua(); var dogs = new DogBase[] { boxer, rotweiler, chihuahua }; Console.WriteLine("Do You want to learn about dogs or dinosaurs? (dog/dino)"); string answer = Console.ReadLine(); if (answer == "dino") { foreach (var dino in dinos) { dino.PrintDinos(); dino.Carnivore(); Console.ReadLine(); } } else if (answer == "dog") { foreach (var dog in dogs) { dog.PrintDogs(); dog.Loyalty(); Console.ReadLine(); } } }
public TriceratopsToMammalAdapter(Triceratops triceratops) { this.triceratops = triceratops; }