W
watsonyin
Unregistered / Unconfirmed
GUEST, unregistred user!
怎样在类A中访问类B的私有变量?如下所示:
unit Unit2;
interface
type
B = Class
private
bValue:Integer;
public
procedure SetValue(Value:integer);
end;
type
A = Class
private
AValue:Integer;
public
procedure GetValue();
end;
implementation
procedure A.GetValue();
begin
aValue:=bValue
//此处错误,找不到bValue
end;
procedure b.SetValue(Value:integer);
begin
bValue:=Value;
end;
end.
unit Unit2;
interface
type
B = Class
private
bValue:Integer;
public
procedure SetValue(Value:integer);
end;
type
A = Class
private
AValue:Integer;
public
procedure GetValue();
end;
implementation
procedure A.GetValue();
begin
aValue:=bValue
//此处错误,找不到bValue
end;
procedure b.SetValue(Value:integer);
begin
bValue:=Value;
end;
end.