Lauren,
Maybe you could start a new thread, seen as we can't seem to post to your original one? That way it will show up in your "My Topics" list.
If you want you could PM your code to me, that way Zephilinox can help krmfsu, and I can help you. You would have to set up your PM so I can reply to you, otherwise I would have to give clues here rather than any code. Clues are what I would normally give anyway (it's your assignment), but sometimes code snippets can be very helpful. Up to you. You could also PM Volatile Pulse, as he has been helping too. Hopefully we say the same things !! :-D Otherwise we could all post to your new thread, but try not give the whole game away.
krmfsu wrote:
We are required to use this piece of code and I believed it to go in the BankingSystem.h file:
private:
vector <Account>accounts_; |
Ok, that answers the question I was asking Lauren. So BankingSystem class could have functions that deal with accts as a whole - AddAcct, DeleteAcct, FindAcct. The Account class could have functions that deal with one acct details.
Edit:
It also shows where the underscore in variables is coming from, I am sure the teacher won't mind if you all use a different variable name - the point was they want you to use a vector of accts. |
krmfsu wrote:
I am not fond of the book we use for the class. |
Text books are often not very good. They purposely have trivial examples, so that the reader can see what the particular feature is for, without blowing them away with something really hard. Other problems are that they show code all in one file with function code inline. This leads the reader into thinking that this is how it is always done - when the reality is that each class should have it's own .h & .cpp files and an application file that has main() in it. Students then run into all kinds of trouble trying to extend the examples.
Often the problem is that people rush through learning the basics of C programming first - The book gives a whirlwind tour of C, then students tear into writing C++ code without really knowing what's going on. Often people start with writing C code but use cout, cin, maybe bool - that's fine (everyone has to start with something - I did that myself, initially). The thing is that C++ is really very different to C.
An example might be a problem to count the number of occurrences of a particular character in a string. The C approach would be to go through the array of chars (that is what a string is, in C), compare each one with the search char and increment the count when one is found. There might be a library function somewhere that does the same thing. The C++ approach is to use the count algorithm on the string - it's just a function that gives you the answer straight up. A C++ string is an array of chars too, but it has all kinds of functionality built in. The C++ algorithms works on all kinds of different objects, not just strings.
What sometimes happens is people mix the C & C++ approaches - I have seen someone use a for loop to process each char in a string and then they had a count algorithm in the body of the for loop as well.
My experience was that my book explained classes and a bit of inheritance, and all the other things, but it didn't help with
class design, probably because that is a whole subject on it's own, so presumably one could get another book to read all about it.
The thing is, books can't cover everything, probably already 500 -1000 pages - that's just to explain the basics. Having said all this, some books might be better than others.