Which is recommended:
class Foo
{
public X x = new X();
public Foo(X _x)
{
x = _x;
}
}
Or
class Foo
{
public X x;
public Foo(X _x)
{
x = _x;
}
}
Please note in the second version, it is probable that I introduce other constructors where x
may not be initialized!
Aucun commentaire:
Enregistrer un commentaire