I need major help on this. I am so lost in C++ and don't understand what is going on. I have the first three done! Please help, I am begging!

1. Draw a UML diagram for the follow class:
--Class name is game
--Privage integer member called level
--Public constructor which accepts an integer for the level
2 Write a class declaration for the above class, as in a header file
3. Write just the constructor which uses an integer, as in a cpp file
--Ensure the level is initialized with the passed integer
4.Write the declaration of a class, name Spiel, which is derived from Game
--ensure that you include a reference to its header file
5. Assuming the game class had a virtual function: void Roll(), how would it be written in the derived Spiel class' delcartion?
6.Write a function to be a friend of Spiel and print out Speils' level
--the friend function should take a reference to an ostream and
--it should take a reference to spiel
--show how the friend function would be delacred in speil's header file
7. If ptr_game is a pointer to a game, how would you use it to reference getLevel()?
8.For the Game, declare an array of type doulbe, call it data; give it 100 elements
9. for the game, declare a pointer of type double, call it ptr_double
10.On a seperate line, let ptr_double refer to the arry data
11.for the game, declare a value of type double, call it score
12. on a seperate line, let prt_double refer to score
13. let prt_double refer to an array of 50 dynamically allocated doubles
14. assuming we are done with ptr_double, de-allocate the array of doubles
15. if another copy of game were to be created, discuss the ramifications of having ptr_double point to dynamically allocated doubles.

Recommended Answers

All 3 Replies

Post the code you've completed. We don't care how much you beg, no proof of effort results in no help.

-level: int

+game(int): void

2. class game
public: void game (int level);
void getlevel();

3. #include <iostream>
# include "game.h"

int game::getlevel()
return level;

#include "game.h"

class speil: public game
member list;

and I do apologize, I have never used a forum like this before. Sorry

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.