You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
В дефолтном конструкторе у тебя нет проблем с тем, чем инициализируются твои данные, ты это и так контролируешь, потому проблемы нет. А в не дефолтном конструкторе есть две стратегии:
ты помещаешь assert в тело конструктора и умираешь при неправильных данных.
ты помещаешь в тело конструктора функцию, который чистит данные и строит объект с поддержкой всех инвариантов класса.
The text was updated successfully, but these errors were encountered:
а что делать с тем, что я хочу assert в конструкторе, чтобы всякие плохие значения не появлялись?
Originally posted by @isaf27 in #1
В дефолтном конструкторе у тебя нет проблем с тем, чем инициализируются твои данные, ты это и так контролируешь, потому проблемы нет. А в не дефолтном конструкторе есть две стратегии:
The text was updated successfully, but these errors were encountered: