汽车类.轮子类,发动机类。。。delphi的一些问题
来源:互联网 发布:热力学计算软件 手机 编辑:程序博客网 时间:2024/04/27 21:27
delphi中能否让一个子类既继承父类又实现定义好的接口?怎么实现?
比如
昵称: hhkun0120 时间: 2011-08-31 23:13:34
- Delphi(Pascal) code
unit Unit3;interfaceuses SysUtils;type carMove = interface function SpeedDown(): string; //减速 function ShutDown(): string; //停止 function Start(): string; //启动 function carspeedUp(): string; function StartBrake: string; //启动刹车 end; {父类:汽车类} Tcar = class(TObject) private name: string; Fwheel: Twheel; Fbrake: Tbrake; Fengine: Tengine; Fcarbody: Tcarbody; public function CarPackage(s: string): string; virtual; //组装汽车 end; TAodiQ7 = class(TCar, carMove) private protected // interface carMove function SpeedDown(): string; //减速 function ShutDown(): string; //停止 function Start(): string; //启动 function carspeedUp(): string; function StartBrake: string; //启动刹车 public function CarPackage(s: string): string; override; end;implementation{ TAodiQ7 }function TAodiQ7.CarPackage(s: string): string;beginend;function TAodiQ7.carspeedUp: string;beginend;function TAodiQ7.ShutDown: string;beginend;function TAodiQ7.SpeedDown: string;beginend;function TAodiQ7.Start: string;beginend;function TAodiQ7.StartBrake: string;beginend;{ Tcar }function Tcar.CarPackage(s: string): string;beginend;end.
昵称: jayqiang 时间: 2011-09-01 08:31:04
谢谢,我还想问下
这个Sysutils 是什么样的一个库?
- Delphi(Pascal) code
- //Sysutils是Pascal的一个库 uses Sysutils这个语句的意思就是调用这个库uses Sysutils;
这个Sysutils 是什么样的一个库?
昵称: hhkun0120 时间: 2011-09-01 09:58:39
Sysutils 是系统工具库
昵称: sz_haitao 时间: 2011-09-01 10:07:33
- Delphi(Pascal) code
- [Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: 'QueryInterface'[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_AddRef'[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_Release'[Pascal Error] TAodiA4cls.pas(29): E2008 Incompatible types[Pascal Error] TAodiA4cls.pas(35): E2003 Undeclared identifier: 'Result'[Pascal Fatal Error] CarProject.dpr(15): F2063 Could not compile used unit '..\src\TAodiA4cls.pas'
貌似接口写的不合规定
我到网上先查查
昵称: hhkun0120 时间: 2011-09-01 10:08:29
系统工具库里具体有什么常用的东西?
能否给几个例子。
能否给几个例子。
昵称: hhkun0120 时间: 2011-09-01 10:10:28
直接继承就可以了, class的只能够继承一个, 但接口是可以无限多个的
Child = class(Parent, Interface....)
Child = class(Parent, Interface....)
昵称: dfasri 时间: 2011-09-01 10:23:56
使用Sysutils 是不是因为interface是系统工具库中的类?
昵称: hhkun0120 时间: 2011-09-01 10:26:42
[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: 'QueryInterface'
[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_AddRef'
[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_Release'
继承接口,必须实现这3个成员
[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_AddRef'
[Pascal Error] TAodiA4cls.pas(21): E2003 Undeclared identifier: '_Release'
继承接口,必须实现这3个成员
昵称: diecode 时间: 2011-09-01 11:16:46
对上面回答不满意?
- 汽车类.轮子类,发动机类。。。delphi的一些问题
- 汽车类继承的问题
- 抽象类(汽车问题)
- 汽车名词解释-发动机参数
- 经典造轮子-String类的实现
- 类redis的“轮子”知多少
- 汽车类
- 东安成为汽车制造商青睐的发动机供应商
- Delphi汽车类作业之反思与改进
- Delphi XE 的一些新类
- 机械汽车类的视频教程
- 【造轮子】utils工具类(常用方法的封装)
- C++汽车类实例
- Delphi重要语法和OO特性——汽车类作业
- DELPHI线程类挂起的问题
- 汽车名词解释-发动机参数(2)
- 了解汽车“心脏” 发动机基本构造详解
- C++的一些经典开源轮子
- listView透明背
- 推送通知服务
- 并查集(poj1611、2524、2492、1182)
- 应用程序栏
- SQL * plus
- 汽车类.轮子类,发动机类。。。delphi的一些问题
- 主题样式与数据绑定
- 动态二维数组的分配与释放
- ffmpeg移植android及应用
- java native interface(java 本地方法调用)
- 设备的开发
- Android SAX解析远程服务器端的xml,防止解析的时候出现空格或者标点符号再次解析的方法
- 指针的强制类型转换思考
- android软键盘弹出引起的各种不适终极解决方案