C++ Workshop - Project 2

Started by
94 comments, last by Warlord_Shaun 15 years, 11 months ago
1. jwalsh: Please just post the remaining days of the workshop, or at least just post the next project, I'd really like to know what it is...

2. Regarding the polymorphism problem discussed at the beginning of this project-2, it seems that RTTI was the only solution (weather using dynamic_cast or pimpl). But Jesse liberty said (i think day 12, or 14) that RTTI might be a sign of poor design and that one should consider using multiple inheritance instead. well, how would multiple inheritance help in this case? and if RTTI is a bad idea, what do they really do in real big programs out there?

Also, on day 12 in the book "you can't get there from here":
Quote:Although you can transform the Mammal pointer into a Dog pointer, there are usually far better and safer ways to call the WagTail() method. C++ frowns on explicit casts because they are error-prone. This subject will be addressed in depth when multiple inheritance is covered, and again when templates are covered on Day 20, "Exceptions and Error Handling."


where in multiple-inheritance and day-20 does the book deal with this?
Advertisement
Quote:Original post by kingIZZZY
1. jwalsh: Please just post the remaining days of the workshop, or at least just post the next project, I'd really like to know what it is...

2. Regarding the polymorphism problem discussed at the beginning of this project-2, it seems that RTTI was the only solution (weather using dynamic_cast or pimpl).


With regards to the pimpl idiom what type of interface did you end up with for your classes?

I imagine most people who created classes simply had something like:

Item private members
string name;
double cost;

Weapon private members
int numberOfDices;
int diceSides;
int critical;
int multiplier;

with the usual get/set methods to access these.

I don't think doing using this approach would work under the pimpl implementation since there is no need for member functions like getNumberOfDices() etc in the item class.

How did you overcome this?

I thought perhaps you could have a method like getItemAttributes() instead of all the get/set methods.

Any ideas?
Just wanted to say that I am going back to this project (had to stop because of other game committments). If you decide to stop the workshop, I really hope you post the next project JWalsh. This has been a huge help to me and alot of others.
i myself am attempting a single player RPG similar to this one, so far though the only place you can fight is in the arena, against enemies that you specefy

furthermore, i was to daft to do it in OOP so it has no classes, also didn't use pointers (that chapter in my book bored me) eventually i will get around to redoing alot of it but as it is my first game for now i will keep it simple as possible

another interesting idea i have is weather, i haven't implemented it yet, but i am going to make random precipitation which will affect the room descriptions and also possibly combat and some other parts of the game






PS: i hate sentences and capitalizing my i's
Quote:PS: i hate sentences and capitalizing my i's

Well, that doesn't mean that we don't deserve this elementary bit of respect. So do yourself a favor. If you don't want to spend the necessary time to properly capitalize your sentences, don't be surprised if you get no positive answer to your questions.
Is all this stuff in DOS or Windows?

This topic is closed to new replies.

Advertisement