Let's consider my class implements Default
. Should I make new()
function?
Yes, if that's a common and useful way to use your type. Convention is to have a new method (with or without parameters).
If there is no single dominant way to create the type, maybe only specific named construction static methods is better.
I implement Default
, which delegates to new()
. I think that new()
is extra.
It's your choice, but it's not uncommon to have new even if you implement Default.
Unless your type is zero-sized, there's probably some setters that your users are going to want to call right after creating it. Make those arguments to new
.
There is no setters, which can be placed into new
.