How much work should the constructor for an HTML parsing class do?

前端 未结 19 1908
悲&欢浪女
悲&欢浪女 2020-12-23 09:55

How much work is it reasonable for an object constructor to do? Should it simply initialize fields and not actually perform any operations on data, or is it okay to have it

19条回答
  •  天涯浪人
    2020-12-23 10:46

    I personally put nothing in constructors and have a set of initialization functions. I find standard constructor methods have limited and cumbersome reuse.

提交回复
热议问题