home *** CD-ROM | disk | FTP | other *** search
- unit DnTestModel;
-
- interface
-
- uses
- Classes, DnPerson, DnCountry;
-
- type
- TDnTestModel = class(TComponent)
- private
- FCountries: TCountryList;
- FPersons: TPersonList;
- public
- constructor Create(aOwner: TComponent); override;
- destructor Destroy; override;
- function AddCountry(aCountryName: string): TCountry;
- published
- property Persons: TPersonList read FPersons;
- property Countries: TCountryList read FCountries;
- end;
-
- implementation
-
- { TDnTestModel }
-
- function TDnTestModel.AddCountry(aCountryName: string): TCountry;
- begin
- result := TCountry.Create(Self);
- result.CountryName := aCountryName;
- Countries.Add(result);
- end;
-
- constructor TDnTestModel.Create(aOwner: TComponent);
- begin
- inherited;
- FCountries := TCountryList.Create;
- FPersons := TPersonList.Create;
- end;
-
- destructor TDnTestModel.Destroy;
- begin
- FCountries.Free;
- FPersons.Free;
- inherited;
- end;
-
- end.
-