zoukankan      html  css  js  c++  java
  • d 属性: 赋予字段执行动作的能力

    1、对只读属性误解

    property AppSetting: ISuperobject read fAppSetting;
    当看到
    AppInfo.AppSetting.D['lastLat'] := FLastLat;
    AppInfo.AppSetting.I['lastZoom'] := FLastZoom;
    时,惊讶只读属性的AppSetting怎么可以写操作呢?
    原来整个 AppSetting 不可以写,但是里面的细项是可以操作的,不可以整个赋值而已。

    2、属性数组 也可以多个参数的
    function GetPurviewVisible(const GUID_Addr: string; const GUID_Mapping: string): boolean;
    property Visible[const GUID_Addr: string; const GUID_Mapping: string]: boolean read GetPurviewVisible;
    注:这个相当于是直接调用函数, 其实属性的作用?

    他本身就是一个变量,
    自己定义了get和set方法,
    如果楼主想取得这个值的时候,程序执行的时候,自动的调用get方法,GET方法最后将这个值做为result返回。。。
    如果要更改这个值的时候,会调用set方法,,,value就是我们 :=更改值
    做为参数传给set方法,然后调用set方法进行操作。。

    如果是只写属性,还不如直接用方法;

  • 相关阅读:
    BZOJ5368:[PKUSC2018]真实排名(组合数学)
    【HDU2222】Keywords Search
    KMP算法
    【BZOJ3262】 陌上花开
    【POJ2104】kth num
    【BZOJ1251】序列终结者
    【BZOJ3524】 [Poi2014]Couriers
    【BZOJ2049】 [Sdoi2008]Cave 洞穴勘测
    【BZOJ1468】Tree
    【BZOJ2152】聪聪可可
  • 原文地址:https://www.cnblogs.com/rogge7/p/6007205.html
Copyright © 2011-2022 走看看