Is it ever good or bad to have a constructor create new instances of classes that it needs versus passing in a reference that you want the new class to have ?
So basically it's the difference between:
A classA = new A();
B classB = new B(classA);
and have class B constructor assigning classA to its field/property.
compared with:
B classB = new B();
and
public class B{
A classA {private set; get;}
//constructor
public B(){
classA = new A();
}
}
Does the latter example violate single responsibility since its creating and assigning? Is this too much magic in that its doing stuff the programmer is not aware of? Should a constructor ever even do that?