Anim.pas
资源名称:delphi.rar [点击查看]
上传用户:fh681027
上传日期:2022-07-23
资源大小:1959k
文件大小:1k
源码类别:
Delphi控件源码
开发平台:
Delphi
- unit Anim;
- interface
- type
- TAnimal = class
- public
- constructor Create;
- function GetKind: string;
- function Voice: string; virtual;
- private
- Kind: string;
- end;
- TDog = class (TAnimal)
- public
- constructor Create;
- function Voice: string; override;
- end;
- implementation
- uses
- MMSystem;
- constructor TAnimal.Create;
- begin
- Kind := 'An animal';
- end;
- function TAnimal.GetKind: string;
- begin
- GetKind := Kind;
- end;
- function TAnimal.Voice: string;
- begin
- Voice := 'Voice of the animal';
- PlaySound ('Anim.wav', 0, snd_Async);
- end;
- constructor TDog.Create;
- begin
- Kind := 'A dog';
- end;
- function TDog.Voice: string;
- begin
- Voice := 'Arf Arf';
- PlaySound ('dog.wav', 0, snd_Async);
- end;
- end.