Ditch Tpeople, create an array of Tperson (Apeople)

For loop := low(Apeople) to high(Apeople) do
    insert into myDatabase Apeople[loop].n1,Apeople[loop].n2,.......etc

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf
Of Alan Colburn
Sent: 12 December 2006 17:56
To: delphi@elists.org
Subject: Learning OOP [part 5]

Several of you responded to my questions last summer re: OOP. You were very
helpful. You are, in fact, my major conduit to the Delphi world. As a
hobbyist, I've never spoken to a Delphi developer live and in person :-) . .
. Now I'm back!
 
I'm a little confused about OOP and databases. To show you what I mean,
consider a hypothetical application: a GUI has a ListBox (which displays a
list of people's names) and labels to display information about the person
selected in the ListBox. Form1 creates an instance of a TPeople class.
TPeople is a list-type class, derived from TObjList, and made up of TPerson
instances created by TPeople. TPerson holds a few properties with
information about a person. 
 
TPeople has a property that returns a TStrings object with people's names,
which Form1 could call directly and display in the ListBox. To display
information about the selected person, Form1 would call the TPeople object
which, in turn, would return information about an object in its list. Assume
that when a new person is added to the app, TPeople creates a new TPerson
object and simultaneously adds the person's name to its StringList of names.

 
So, some of the information displayed in the GUI would be in the TPeople
object, and some of it would be in the TPerson objects. How would one go
about saving all this, esp. in a simple
MyBase/ClientDataSet/DataSource-style database?
 
As always, thanks for your help -- Al C.
_________________________________________________________________
Search from any Web page with powerful protection. Get the FREE Windows Live
Toolbar Today!
http://get.live.com/toolbar/overview
_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi




_______________________________________________
Delphi mailing list -> Delphi@elists.org
http://www.elists.org/mailman/listinfo/delphi

Reply via email to