3 levels objects...need help.
From: Bob Bedford (bob_at_bedford.com)
Date: 10/30/03
- Next message: Anchorman: "ShellExecute not working properly"
- Previous message: Arda Han: "1 function for MDIChils"
- Next in thread: John Herbster \(TeamB\): "Re: 3 levels objects...need help."
- Reply: John Herbster \(TeamB\): "Re: 3 levels objects...need help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 30 Oct 2003 13:48:05 +0100
I'm trying to coding "Object oriented" and I need help: TPlane.GroupList is
an objectList of TGroup, and TGroup.PassList is an objectList of
TPassDetail.
I must manage a plane (TPlane), a Group of Passengers (TGroup) and passenger
detail (TPassDetail). Here is the code:
TPassDetail = Class(TObject)
FirstName : ShortString;
LastName : ShortString;
InfName : ShortString;
Name : ShortString;
ClientID : Integer;
GroupID : Integer;
Color: TColor;
end;
TGroup = Class(TObject)
GroupId : Integer;
Plane_index : integer;
PassList : TObjectList;
public
constructor create;
destructor destroy;override;
Procedure AddPassenger(PassDetail:TPassDetail);
Procedure DelPassenger(PassDetail:TPassDetail);
end;
TPlane = Class(TObject)
Callsign : shortString;
TotalSeats : integer;
AvailableSeats : integer;
GroupList : TObjectList;
Public
constructor create;
destructor destroy;override;
function TestAdd(Group:TGroup):boolean;
Procedure ResetPlaces;
Procedure AddGroup(Group:TGroup);
Procedure AddPassenger(Passenger:TPassenger);
Procedure DelPassenger(Passenger:TPassenger);
end;
I'm trying to create a function that Creates a Passenger in an airplane.
This is because I have many grids for managing seats in many aircrafts, and
I may switch passengers between aircrafts. So when I do a Drag&Drop between
aircrafts, I want to add a new passenger in an aircraft and remove him from
the first one. So I don't know if AddPassenger goes in TPlane or not (as
TPlane don't know that in his GroupList they are Passengers, or should I
first call TGroup.addPassenger and then Tplane.AddGroup ??? a Group is done
if they have the same GROUPID.
Something else: What does not sound good to me, is TPassDetail.GroupID (as
this is stored by his container, the TGroup object). It's there any way, for
a passenger, to know in wich group it is in without adding this field in the
TPassDetail object ???
BoB
- Next message: Anchorman: "ShellExecute not working properly"
- Previous message: Arda Han: "1 function for MDIChils"
- Next in thread: John Herbster \(TeamB\): "Re: 3 levels objects...need help."
- Reply: John Herbster \(TeamB\): "Re: 3 levels objects...need help."
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|