🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.comp.lang.learn.c-c++
Article #59

Re: class help

#59
From: John Harrison
Date: Tue, 01 May 2001 21:04
40 lines
2753 bytes
"Ron Natalie" <ron@spamcop.net> wrote in message
news:3AEF1F74.C963F0B7@spamcop.net...
>
>
> John Harrison wrote:
>
> >     int num_of_accounts;
> >     BankAccount the_accounts[100];
> >
> > You see? The BankDB object holds (upto) 100 BankAccount objects. This is
how
> > BankDb 'calls' an instance of BankAccount. E.g.
>
> No, BankDB holds exactly 100 BankAccount objects, not upto.

I think that depends on your point of view. Notionally the BankDB may hold
upto 100 accounts, even if 'physically' its always holding exactly 100.
Proabably that distinction was why I put 100 in brackets.

> If you want a dynamic number try:
> vector<BankAccount> the_accounts;

Yep, if the OP wants to go for this then by all means.

>
> > This approach has the limitation that you can only have a maximum of 100
> > account in BankDB, there are various ways around that but at your level
of
> > skill I'd stick with that for now.
>
> At his skill level, he should be learning to use the standard containers
> rather than screwing around with the suboptimal array type in C++.  I
> recommend Koenig and Moo's Accelerated C++ as a text that teaches you
> the good habits first, rather than propagating C ugliness into C++.

Again I couldn't agree more, I felt however that the OP was unlikely to take
this advice. Just an intuition.

john
Technical Details
Message-ID: <fwFH6.13860$wO6.1955835@news2-win.server.ntlworld.com>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail
References: <9cms6r$emm$1@neptunium.btinternet.com> <S2FH6.13187$Kt2.1288005@news6-win.server.ntlworld.com> <3AEF1F74.C963F0B7@spamcop.net>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: 114592,bcfa6c5c8a6717c0
X-Google-Attributes: gid114592,public
X-Google-Thread: 10d4ba,bcfa6c5c8a6717c0
X-Google-Attributes: gid10d4ba,public
X-Google-Thread: 109fba,bcfa6c5c8a6717c0
X-Google-Attributes: gid109fba,public
X-Google-ArrivalTime: 2001-05-01 14:08:12 PST
Path: arc1-ca.pugleaf.net!newsfeed.google.com!newsfeed.stanford.edu!news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!news5-gui.server.ntli.net!ntli.net!news2-win.server.ntlworld.com.POSTED!not-for-mail
Reply-To: "John Harrison" <jahhaj@bigfoot.com>
From: "John Harrison" <jahhaj@bigfoot.com>
Newsgroups: alt.comp.lang.learn.c-c++,att.lang.c++,comp.lang.c++
References: <9cms6r$emm$1@neptunium.btinternet.com> <S2FH6.13187$Kt2.1288005@news6-win.server.ntlworld.com> <3AEF1F74.C963F0B7@spamcop.net>
Subject: Re: class help
Lines: 43
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4522.1200
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200
Message-ID: <fwFH6.13860$wO6.1955835@news2-win.server.ntlworld.com>
Date: Tue, 1 May 2001 22:04:07 +0100
NNTP-Posting-Host: 213.105.5.194
X-Complaints-To: abuse@ntlworld.com
X-Trace: news2-win.server.ntlworld.com 988750987 213.105.5.194 (Tue, 01 May 2001 22:03:07 BST)
NNTP-Posting-Date: Tue, 01 May 2001 22:03:07 BST
Organization: ntlworld News Service