<< split from http://www.daniweb.com/forums/thread67837.html >>

I need to print post #15. How do I do that? I can't seem to find the button. I need it just as it was written here.

Also, do I need to know C++ classes in order to be able to implement the in-game classes?

Thanks in advance!

Recommended Answers

All 4 Replies

You don't NEED to implement the game's classes with C++ classes, but this is a typical case where object oriented programming(using classes) comes in handy.

There isn't a single-best way to something like this but if you decide to use C++ classes you could decide to make a:

- "common" class that holds all functions that every character has, like the amount of cash, and it would define the game class of this character(e.g. warrior).

Then for each game class you create a c++ class (maybe even this you could split into 1 common class that has functions like attack, drink potion and 1 class that inherits from this class and has the character-specific properties).

In short, there are many ways in which you could code this, if you're serious about learning C++ then you really should look at classes ;)

Well... the moderator has misunderstood me. I didn't ask how to implement classes, I'd say it's something too big to be discussed entirely/properly on a discussion board. I'm following a book, I haven't got to classes yet, and I was willing to start solving that exercise. All I wanted to know is if classes will be needed, not how to implement them.

I didn't misunderstand you, I just gave a short, uncomplete example of how you might implement classes.

In my very first sentence I note that it is not needed to use C++ classes to implement these game classes, instead you probably would use structures to store the character-specific information. So no one is forcing you to use classes in this case.

You're not a moderator, so you can't be the one I was talking about (that being John A).

Be a part of the DaniWeb community

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