Initialize in constructor or with variable declaration

Hello all,

I’m working on a new mostly-open source game engine and I’m trying to make sure I keep everything as clean as possible.

One thing that I’ve been debating for a while is whether I should declare the initial values of my data with the declaration of it in the class or within the constructor when it’s created.

I’m not quite sure what (if any) the differences in the two approaches have.

Anyone care to give me some advice?

Thanks.

P.S. For those that aren’t quite sure what I’m talking about, I’m talking about the difference between:


class MyClass {
    protected var mScore:int = 0;
    protected var mTargets:Vector.<Sprite> = new Vector.<Sprite>();

    public function MyClass() {
    }
}

and


class MyClass {
    protected var mScore:int;
    protected var mTargets:Vector.<Sprite>;

    public function MyClass() {
        mScore = 0;
        mTargets = new Vector.<Sprite>();
    }
}

Nobody has an opinion on this?