Hi folks,
I am new the arena of object modelling, and am finding EA very useful is tracking what I am doing.
I am looking for some help with a modelling query I have. I am sure its a pretty simple question, but the answer will help in pointing me in the right direction at the start of my modelling task. I'd appreciate any pointers you can offer.
I want to display a window, differing in a number of respects depending on the authority of the user who has logged in. E.g. admin functions are only available to administrators etc.
I could do something like
newperson := user.create(userid);
If newperson.type = 'administrator' then
begin
DispWindow.button1.Visible := True;
DispWindow.Button2.Visible := True;
DispWindow.Caption := 'Admin logged in';
etc
end
else if newperson.type = 'normal' then
begin
DispWindow.button1.Visible := False;
DispWindow.Button2.Visible := False;
DispWindow.Caption := 'User logged in';
etc
end;
but what I'd really like to do would be something like:
newperson := Administrator.Create;
newperson.DisplayWindow;
Where the DisplayWindow method of the Administrator class contained:
begin
DispWindow.button1.Visible := True;
DispWindow.Button2.Visible := True;
DispWindow.Caption := 'Admin logged in';
etc
end;
as before.
As I say I'm new to this, but the second approach looks more OO like to me, and would result in me having a person class with Administrator, NormalUser etc classes descending from it.
Does this make sense?

Thanks