The unit myclass.
Interface
Type
//define class
MyClassSample=class
UserName: string;
Age: Integer;
Procedure SetValue (UN: string; Age: Integer);
end;
Implementation
Procedure SetValue (UN: string; Age: Integer);
The begin
UserName:=UN;
Age:=age;
end;
End.
CodePudding user response:
procedure SetValue (var A: MyClassSample; Un: string; Age: Integer);
The begin
A.U serName:=UN;
A.a ge:=age;
end;
CodePudding user response:
Avoid variable constant, the same name in parameters, adding a type identifier is not confused sinceProcedure SetValue (sUserName: string; Iage: Integer);
CodePudding user response:
Class variables, a class member function, you can access your code, SetValue statement belongs to a class member function, but to realize the function of a class member function, the compiler should go wrong,
The unit myclass.
Interface
Type
//define class
MyClassSample=class
UserName: string;
Age: Integer;
Procedure SetValue (UN: string; Age: Integer);
end;
Implementation
Procedure MyClassSample. SetValue (UN: string; Age: Integer);
The begin
UserName:=UN;
Age:=age;
end;
End.
CodePudding user response:
Correction, CSDN set the font is to code
The unit myclass.
Interface
Type
//define class
MyClassSample=class
UserName: string;
Age: Integer;
Procedure SetValue (UN: string; Age: Integer);
end;
Implementation
Procedure MyClassSample. SetValue (UN: string; Age: Integer);
The begin
UserName:=UN;
Age:=age;
end;
End.
CodePudding user response:
Instead of process procedure MyClassSample. SetValue (UN: string; Age: Integer);