static void Main(string[] args) { var robot = new Dog { Greeting = "Bark Bark", Activity = "Relax" }; robot.MixSay(); robot.MixAct(); var builder = new Human { Greeting = "Hello", Activity = "Hardworking"}; builder.MixSay(); builder.MixAct(); Console.ReadKey(); }
static void Main(string[] args) { try { Dog dog = new Dog(); Dog labrador = new Labrador(); dog.Feed(); labrador.Feed(); } catch (Exception ex) { Console.WriteLine(ex.Message); } Console.ReadKey(); }
public void Feed(Dog dog) { Console.WriteLine("{0} feeds {1}", name, dog.name); }