H
handsome1234
Unregistered / Unconfirmed
GUEST, unregistred user!
program Project1;
{$APPTYPE CONSOLE}
uses
SysUtils;
type
Thuman=class
Name:string;
end;
TStudent=class(Thuman)
SchoolName:string;
procedure ShowInf;
end;
ClassRef=class of TObject;
var
Student:array[0..1]of TObject;
I:Integer;
CRef:array[0..1] of ClassRef;
{TStudent}
procedure TStudent.ShowInf;
begin
WriteLn('姓名',Name,',学校:',SchoolName);
end;
begin
CRef[0]:=Thuman;
Cref[1]:=TStudent;
for I:=0 to 1 do
begin
Student:=CRef.Create;
if Student is TStudent then
begin
(Student as TStudent).Name:='王松';
(Student as TStudent).SchoolName:='树人小学';
(Student) as TStudent).ShowInf;
end;
end;
Readln;
end.
{$APPTYPE CONSOLE}
uses
SysUtils;
type
Thuman=class
Name:string;
end;
TStudent=class(Thuman)
SchoolName:string;
procedure ShowInf;
end;
ClassRef=class of TObject;
var
Student:array[0..1]of TObject;
I:Integer;
CRef:array[0..1] of ClassRef;
{TStudent}
procedure TStudent.ShowInf;
begin
WriteLn('姓名',Name,',学校:',SchoolName);
end;
begin
CRef[0]:=Thuman;
Cref[1]:=TStudent;
for I:=0 to 1 do
begin
Student:=CRef.Create;
if Student is TStudent then
begin
(Student as TStudent).Name:='王松';
(Student as TStudent).SchoolName:='树人小学';
(Student) as TStudent).ShowInf;
end;
end;
Readln;
end.