zoukankan      html  css  js  c++  java
  • property特性

     TVirtualProperty = class
      private
        FSomeData:string;
      protected
        function  GetSomeData:string;virtual;
        procedure SetSomeData(const value:string);virtual;
      public
        property SomeData:string read GetSomeData write SetSomeData;
      end;

      TSubClass = class(TVirtualProperty)
      protected
        function GetSomeData:string;override;
        procedure SetSomeData(const value:string);override;
      end;

    var
      Form1: TForm1;

    implementation

    {$R *.dfm}

    procedure TForm1.FormCreate(Sender: TObject);
    var
      vp:TVirtualProperty;
    begin
      vp:=tsubclass.Create;
      try
          vp.SomeData:='Follow me';
          showmessage(vp.SomeData);
      finally
          vp.Free;
      end;
    end;

    { TVirtualProperty }

    function TVirtualProperty.GetSomeData: string;
    begin
       result:=FSomeData;
    end;

    procedure TVirtualProperty.SetSomeData(const value: string);
    begin
       FSomeData:=value;
    end;

    { TSubClass }

    function TSubClass.GetSomeData: string;
    begin
       result:= inherited GetSomeData;
    end;

    procedure TSubClass.SetSomeData(const value: string);
    begin
     // inherited;
      if (someData= value) then exit;
      inherited SetSomeData(value);
    end;

    end.

  • 相关阅读:
    CSS3弹性盒布局方式
    Vue知识点(面试常见点)
    h5新增加的存储方法
    前端常用插件
    Git 及 GitHub 使用
    Express 框架
    angular.js 教程 -- 实例讲解
    Windows右键添加VSCode启动
    Windows平台SSH登录Linux并使用图形化界面
    10_Linux yum命令
  • 原文地址:https://www.cnblogs.com/hqyj/p/2158091.html
Copyright © 2011-2022 走看看