(1) design an abstract class Animal, has the category, properties, such as speed has called, eat, abstract methods such as preferences;
(2) design, each derived class the Cat and Dog inheriting Animal, asked Cat class implement the abstract methods respectively output (" meow ", "fish", "mouse") and implement abstract methods respectively output in a Dog class (" wang wang ", "eat meat", "hunting");
(3) design the Cat and Dog object, set the category of the Cat object as "Cat", the speed of 30 km/h. Set a Dog object categories for "Dog", speed of 60 km/h, the output of each object's properties and methods, and compare the speed of the object, the comparison results are given,
CodePudding user response:
Suggestions to the C # zone, still have very big distinction, C # and C ~ first clear direction