What should not be in a constructor?

Don’t use init()/cleanup() members . If you have to call init() every time you create an instance, everything in init() should be in the constructor. The constructor is meant to put the instance into a consistent state which allows any public member to be called with a well-defined behavior.

Sizin İçin Seçtik  What is a constructor explain the different types of constructors?

Leave a Reply

Your email address will not be published. Required fields are marked *