okay, the program contains several kinds of flowers, the first thing we need is to define a base class, let's call it Plant
, it will represent a plant of any type, and the classes that represent flowers are derived of this base.
polymorphic (contains virtual functions), so that derived classes can override them.
it should contain a print
function to draw the object on screen, this function might be pure virtual, because you can't draw an unknown plant.
because we are going to draw several plants on the same line, you should make two functions, one to draw the top of a plant, maybe call it (drawTop()
) and the other to draw the leg of it, could be (drawLeg()
), and both must be virtual.
this way, when we define an array of plants we can draw the tops on the first line, then go one line down to draw the legs.
when you've finished this class, post it and we may discuss if it contains any errors, or bad programming habits.
if you don't know polymorphism, check this:
there's one little problem, i forgot to tell you that this project requires a bit of pointers operations, this is because we're using polymorphism.