vcl.net overload学习
type
Tmyclass =class(System.Object)
private
Fname: string;
public
procedure set_name(const Value: string);
property name:string read Fname write set_name;
constructor Create; overload;
constructor Create(const setprivate:string);overload;
end;
{ Tmyclass }
procedure TForm1.Button2Click(Sender: TObject);
var s:Tmyclass;
begin
s :=Tmyclass.Create ;
s.name :='小贺';
showmessage(s.name)
end;
constructor Tmyclass.Create;
begin
inherited;
end;
constructor Tmyclass.Create(const setprivate: string);
begin
Fname := setprivate;
inherited Create;
//这个很重要,一定要加上,.......
end;
procedure Tmyclass.set_name(const Value: string);
begin
Fname := Value;
end;