D
dajiangxu
Unregistered / Unconfirmed
GUEST, unregistred user!
我刚学delphi没几天,试着编写个简单的类。脑袋里面面向对象思想还没形成。请高手帮我看看下面的代码,指点一下我入门。非常感谢!
thuman=class
private
addr:string;
public
function getaddress(adr:string):string;
procedure showinf;
end;
function thuman.getaddress(adr:string):string;
begin
result:=adr;
end;
procedure thuman.showinf;
begin
showmessage(addr);
end;
var
m:thuman;
begin
m:=thuman.Create;
addr:=m.getaddress('aaaa'):string; //这边出错
procedure m.showinf;
m.Destroy;
end;
thuman=class
private
addr:string;
public
function getaddress(adr:string):string;
procedure showinf;
end;
function thuman.getaddress(adr:string):string;
begin
result:=adr;
end;
procedure thuman.showinf;
begin
showmessage(addr);
end;
var
m:thuman;
begin
m:=thuman.Create;
addr:=m.getaddress('aaaa'):string; //这边出错
procedure m.showinf;
m.Destroy;
end;