nick wrote:
Okay, I think I see your point. So let me rewrite it and tell me if I'm
on the right track....
I create an object called bankAccount. I activate all the member
variables and functions for it. So let's say that it has a deposit
amount of 1200. That bankAccount object goes into vector position[0]. I
stay in my loop and it creates another bankAccount object with, let's
say, a 300 deposit. That goes into my vector at position[1].
So I then have X amount
... X number ..
of bankAccount objects in my vector with
different deposit amounts. So I need to create a loop to add elements
to the vector just like a for loop with arrays?
I suppose... A standard container 'vector' is essentially a wrapper
around its C++ array of data, with the ability to add to that array (the
"regular" C++ array doesn't allow that) and remove from it. A 'vector'
behaves similarly to the other standard sequential containers, 'list' and
'deque', with a couple of exceptions (lacking a better word).
You were asking about the names of those objects. I am not sure what you
need those names for, but often in banking every account has a number and
an associated customer name. With that information at hand you can either
look up the account (find it in the container) by the number or by the
name, provided that the lookup functionality exists. You don't have to
assign any other "number" than the position in the vector (and the lookup
functionality for it already exists in the indexing operator, []), but you
could add the functionality to look the accounts up by the customer name
as well...
V