Delphi的面向对象(高手不吝赐教)!!!

来源:百度知道 编辑:UC知道 时间:2024/05/18 04:14:03
我们都知道C++中的继承方式有公有,私有,保护方式,每种继承方式都规定在派生类中从基类中继承而来的所有特征的不同访问规则。
1、Delphi中似乎没有以上的继承方式,它跟C++的继承方式又有什么不同之处呢?
2、有时,Delphi中的定义的类,没有用public,private或是protected关键字标识,我怎么知道哪些成员是公有、私有还是保护呢?
如:
type
THuman=class
name:string;
age:integer;
procedure set_name;
procedure set_age;
end;

DELPHI也有这些内容,参见下面的资料:
http://www.moon-soft.com/doc/5631.htm
http://dev.csdn.net/article/10/10405.shtm

unit Unit1;
下面是一个默认页面的代码,解释如下:
unit Unit1; // 相当于类名
interface
uses //相当于导入包
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs;

type
TForm1 = class(TForm) //说明TForm1继承于TForm
private
{ Private declarations }
//里面定义的变量,函数为私有
public
{ Public declarations }
//里面定义的变量,函数为公有
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

delphi一样也没少
抽象 继承 封装 多态