Program OPLangChange;

{$APPTYPE CONSOLE}

uses
  System,
  Borland.Delphi.Classes,
  Borland.Delphi.SysUtils;

type
  TDemoClass1 = class(System.Object)
  Strict Private
    iSPv : Integer;
  Strict Protected
    iSPr : Integer;
  private
    iPv : Integer;
  protected
    iPr : Integer;
  Public
    ipb : Integer;
  public
    class function GetSystemTime : String;
    class Procedure DelphiComp(var sData : String);
    class Procedure DotNETComp(var sData : String); static;
  end;

  TDemoClass1Ref = class of TDemoClass1;


  TDemoClass2 = class(TComponent)
  public
    Constructor Create; virtual;
  end;

{ TDemoClass2 }

constructor TDemoClass2.Create;
begin
  inherited;

end;

{ TDemoClass1 }

class procedure TDemoClass1.DelphiComp(var sData : String);
begin
  sData := Self.GetSystemTime;
end;

class procedure TDemoClass1.DotNETComp(var sData : String);
begin
  sData := GetSystemTime;
end;

class function TDemoClass1.GetSystemTime: String;
begin
  Result := DateTimeToStr(Now);
end;

var
  myClassObj : TDemoClass1;
  sData : String;
  aClass : TClass;
  aDCClass : TDemoClass1Ref;
  aType : System.Type;
begin
  aDCCLass := TDemoClass1;
  Console.WriteLine(aDCClass.ClassName);

  if (TypeOf(TDemoClass1Ref).IsSubClassOf(TypeOf(TClass))) then
    Console.WriteLine('TDemoClass1Ref是TClass的子類別!')
  else
    Console.WriteLine('TDemoClass1Ref不是TClass的子類別!');

//  Console.WriteLine(myClassObj.iSPv.ToString());
//  Console.WriteLine(myClassObj.iSPr.ToString());
  Console.WriteLine(myClassObj.iPv.ToString());
  Console.WriteLine(myClassObj.iPr.ToString());
  Console.WriteLine(myClassObj.ipb.ToString());
end.
