Why use property in a class?

后端 未结 7 473
闹比i
闹比i 2020-12-17 00:34

I was just wondering about why should I use property in a class instead of \"normal\" variables (class attributes?). What I mean is this:

TSampleClass = clas         


        
7条回答
  •  孤街浪徒
    2020-12-17 01:08

    It is just a good programming practice to isolate the very "innards" of your class from the outside world. In addition, information about published properties are stored into RTTI generated for the class and can be accessed by their name, enumerated etc. This feature is used for example when reading a form from its serialized resource form.

提交回复
热议问题