static void Main(string[] args) { //NEW METHOD USED FLAVOR & LOVING Pineapple PA = new Pineapple("Mrs. Pineknickle", "papple", "yellow", "happy"); PA.flavor("Mrs. Pineapple smells sweet"); PA.loving("Mrs. Pineapple hair is shaped like a flower"); }
static void ShowPolymorphism() { Fruit f; f = new Apple(); //这句输出什么? f.GrowInArea(); f = new Pineapple(); //与前面相同的代码,输出什么? f.GrowInArea(); }