I am so lost with this, I don't even know where to begin. This is not a request for someone to do my homework, just a request for someone to nudge me in the right direction.
On completion of our 6th practical in C++ we must:
be able to interpret a UML class diagram and understand the association concepts of:
● generalisation – inheritance
● aggregation
● dependencies
understand the concepts of and be able to implement in C++:
● inheritance
● polymorphism – virtual
● abstract classes – pure virtual
Here is the image of the UML diagram that we have been given:
Now, our first task is laid out as follows:
Step 1: Implement the Obstacle Class Hierarchy
● Create a file called Obstacle.h
● Implement the classes of the Obstacle class hierarchy in this file.
● The action operation of NastyWeapon writes Nasty Weapon to standard out and Puzzle writes Puzzle to standard out.
● Write a main program to test your classes. An example of such a test program is given by:
Code: Select all
#include "Obstacle.h"
int main(){
Obstacle *p = new Puzzle;
Obstacle *n = new NastyWeapon;
p->action();
n->action();
delete p;
delete n;
return 0;
}
Code: Select all
Puzzle
Nasty Weapon
The only thing that I have done up to this point is I've created the Obstacle.h file, although that file is still empty.
Please Help me...