Object with auto execute procedures

2019-07-25 16:07发布

Is there a way to create an object with auto execute procedures? For example if a variable within this object has changed a private procedure kicks in and starts to do something?

1条回答
可以哭但决不认输i
2楼-- · 2019-07-25 16:47

The language offers no such functionality. You have to implement it yourself.

Typically that's done by hiding the variable as a private, or better a strict private, and then ensure that all access to the variable is routed through a property. Then you can take whatever action you need in the property setter method.

查看更多
登录 后发表回答