What are the best practices for determining the tasks of Constructor, Initialization and Reset methods

前端 未结 5 1683
长发绾君心
长发绾君心 2021-01-22 08:38

This is a general OOP question although I am designing in Java. I\'m not trying to solve a particular problem, just to think through some design principles.
From my experien

5条回答
  •  挽巷
    挽巷 (楼主)
    2021-01-22 09:00

    Interesting. I especially find this construction useful if you have an object that needs to perform IO operations. I do not want anything to perform IO operations direct or indirectly in their constructor. It makes the object a nightmare to use.

提交回复
热议问题