When to use properties instead of functions

后端 未结 6 1335
感情败类
感情败类 2020-11-29 01:43

This is probably a matter of personal preference, but when do you use properties instead of functions in your code

For instance to get an error log I could say

6条回答
  •  北海茫月
    2020-11-29 02:04

    In addition to Reed's answer when the property is only going to be a getter like getting a resource such as an Event Log might be. I try and only use properties when the property will be side effect free.

提交回复
热议问题