program rtti;

{$mode objfpc}{$H+}
{$apptype console}

uses
  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}
  Classes, typinfo
  { you can add units after this };

type
  { TSomeBaseClass }

  TSomeBaseClass = class(TPersistent)
  private
    FSomeProperty: Integer;
  public
    property SomeProperty: Integer read FSomeProperty write FSomeProperty default 10;
  end;

  { TSomeDerivedClass }

  TSomeDerivedClass = class(TSomeBaseClass)
  private
    FOwnProperty: Integer;
  published
    property SomeProperty;
    property OwnProperty: Integer read FOwnProperty write FOwnProperty default 11;
  end;

var
  DC: TSomeDerivedClass;
  Info: PPropInfo;
begin
  DC := TSomeDerivedClass.Create;
  Info := GetPropInfo(DC, 'SomeProperty');
  WriteLn(Info^.Default);
  Info := GetPropInfo(DC, 'OwnProperty');
  WriteLn(Info^.Default);
end.

