home *** CD-ROM | disk | FTP | other *** search
- program staff_oop;
-
- uses Crt;
-
- type
-
- staff = object
- Name : string;
- constructor Init(FirstName : string );
- procedure script; { virtual; } {remove braces around virtual to correct}
- procedure action;
- end;
-
- junior = object( staff )
- procedure script; { virtual; } {remove braces around virtual to correct}
- end;
-
- constructor staff.Init( FirstName : string );
- begin
- Name := FirstName;
- end;
-
- procedure staff.script;
- begin
- writeln( Name,
- ': Please send the duplicated letters to all our customers.');
- writeln( ' If you have a problem, please phone me.');
- end;
-
- procedure staff.action;
- begin
- script;
- end;
-
- procedure junior.script;
- var
- LetterName : string;
- begin
- writeln( 'PHONE: Brrring!');
- writeln( '<pick up phone>' );
- writeln( 'YOU: Hello?' );
- writeln( Name, ': I do not know the letter to send for an overdraft?' );
- write( 'YOU (enter something): ');
- readln( LetterName );
- writeln( Name, ': Thank you. Bye.');
- writeln( '<hang up phone>' );
- writeln( '<pause.......>' );
- writeln( '<later phone call to confirm>');
- writeln( Name, ': As you requested, I sent: ',LetterName );
- end;
-
- var
- Little : junior;
- Large : staff;
-
- begin
- clrscr;
- Little.Init( 'LITTLE' );
- Large.Init( 'LARGE' );
-
- Large.action;
- Little.action;
- gotoXY(10,24);
- writeln('Press any key to conclude: ');
- repeat until keypressed;
-
- end.
-
- { end of Listing }