怎么才能让自定义属性对用户只读
如题,如何设置属性对用户只读?而程序可以改变它的值?用protect和hidden关键词的话,用户也无法访问这个属性了。。。
clea otest=CREATEOBJECT('employee') otest.hiredate={^2022-12-01} ?otest.hiredate otest.sethiredate() ?otest.hiredate DEFINE CLASS employee AS CUSTOM *!* HIDDEN HireDate *!* PROTECTED HireDate First_Name = "Jiang" Last_Name = "Sam" Address = "" HireDate = {^2017-06-05} cprogramname=[] &&用来判断修改者 PROCEDURE GetHireDate RETURN This.HireDate ENDPROC PROCEDURE hiredate_assign PARAMETERS m.vnewval m.voldval=this.hiredate if strextract(this.cprogramname,[.],[])==UPPER([sethiredate]) *!* 检查cprogramname修改者是不是我们制定的方法 this.hiredate=m.vnewval ELSE this.hiredate=m.voldval ENDIF this.cprogramname=[] &&恢复不可修改状态 PROCEDURE sethiredate this.cprogramname=PROGRAM() &&传递方法名给属性cprogramname this.hiredate=DATE() ENDDEFINE