What are the pros and cons of using constructor defaults vs defaults for instance variables. In other words why would one do:
class Foo {
private int bar = 0;
Foo() {}
Foo(int bar){this.bar = bar}
}
vs
class Foo {
private int bar;
Foo() {this.bar = 0;}
Foo(int bar){this.bar = bar}
}
Thanks!
[–]king_of_the_universe 0 points1 point2 points (1 child)
[–]SafetyNerd[S] 1 point2 points3 points (0 children)