使用
(SavingStc as TSampleStaticstics).Save(-1)试一下。而且,你的GetStc的源代码是否能拿出来研究研究?
现在还不能肯定是你的GetStc有问题还是这段代码有问题呢。

解决方案 »

  1.   

    是不是SavingStc:=GetStc;有问题?因为赋值运算符对子类是要重载的。
     可以试试这个:
    procedure sth(SavingStc:TStatistics);
    begin
      if SavingStc is TSampleStatistics then
         TSampleStatistics(SavingStc).Save(-1)
      else if SavingStc is TComplexStatistic then
         TComplexStatistic(SavingStc).Save(-1)
      else if SavingStc is T2DimStatistics then
         T2DimStatistics(SavingStc).Save(-1)
      else
        SavingStc.Save(-1);
    end;
      

  2.   

    直接Save如果Save是虚方法的话