R
Razzie
Hello all,
This may seem like a silly question but I suddenly wondered about this. Is
there any difference between the following 2 situations?
1)
class A
{
private SomeObject o = new SomeObject();
public A()
{}
}
2)
class A
{
private SomeObject o;
public A()
{
this.o = new SomeObject();
}
}
Is there any difference at all? If there is, what is it, maybe memory
allocation wise, or something, what method is 'better'? Or would it only
matter (obviously) if you have multiple constructors? Or am I questioning
myself the most weird and useless things
Thanks!
This may seem like a silly question but I suddenly wondered about this. Is
there any difference between the following 2 situations?
1)
class A
{
private SomeObject o = new SomeObject();
public A()
{}
}
2)
class A
{
private SomeObject o;
public A()
{
this.o = new SomeObject();
}
}
Is there any difference at all? If there is, what is it, maybe memory
allocation wise, or something, what method is 'better'? Or would it only
matter (obviously) if you have multiple constructors? Or am I questioning
myself the most weird and useless things

Thanks!