initialize category fields constructor during declaration?
i've programming c# java recently i am extraordinary where best place initialize category fields.
should i during declaration?:
public category dice
{
private int topface = 1;
private futile myrand = new random();
open vacant roll()
{
// ......
}
}
or constructor?:
public category dice
{
private int topface;
private futile myrand;
open dice()
{
topface = 1;
myrand = new random();
}
open vacant roll()
{
// .....
}
}
i'm unequivocally extraordinary veterans cruise best practice. i wish unchanging hang approach.
Comments
Post a Comment