초보라 잘 몰라서 물어요..
type
TMy=class
i:byte;
procedure init(you:TMy);
end;
var My,Your:TMy;
procedure TMy.init;
begin
i:=0;
end;
procedure TMy.A1(you:TMy=nil);
begin
if you=nil then you:=(TMy); <==
...
you.i:=10;
end;
procedure A1;
var n:byte;
begin
My:=TMy.Create; My.init;
Your:=TMy.Create; Your.init;
My.A1();
My.A1(You);
end;
A1에 인자가 없으면 My.i:=10 이고, 있으면 인자.i:=10이고 싶은데 어떻하져..??
> 초보라 잘 몰라서 물어요..
>
> type
> TMy=class
> i:byte;
> procedure init(you:TMy);
> end;
> var My,Your:TMy;
>
> procedure TMy.init;
> begin
> i:=0;
> end;
> procedure TMy.A1(you:TMy=nil);
> begin
> if you=nil then you:=(TMy); <==
> ...
> you.i:=10;
> end;
>
> procedure A1;
> var n:byte;
> begin
> My:=TMy.Create; My.init;
> Your:=TMy.Create; Your.init;
> My.A1();
> My.A1(You);
> end;
> A1에 인자가 없으면 My.i:=10 이고, 있으면 인자.i:=10이고 싶은데 어떻하져..??
>
if you=nil then you := Self;
이거 물어보신거 맞죠?? 질문 해석이 무지하게 힘들었음..^^