I'm just having a play around with inheritance and a few other concepts at the moment.
I have created a console app that amongst other things, holds the following classes:
Public abstract Organism
Public abstract Animal : Organism
Public Bird : Animal
Public Mammal : Animal
Public Reptile : Animal
Public Fish : Animal
Public Amphibian : Animal
Public Human : Organism
When the console app starts, I want to create a new object from either the Human, Fish, Mammal, Reptile, Bird or Amphibian class. Which one of these classes to instantiate is to be randomly chosen.
Once a class has been randomly chosen, I've used console.writeline to ask the user key questions to assign values to the given objects properties.
How do I create a random object from one of these classes?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…