S
Satish12321
Guest
Is there any difference between the following two object instantiation?
Case 1: Instantiation inside constructor
Class Engine
{
}
Class Car
{
public Engine engine;
public Car()
{
engine = new Engine();
}
}
Case 2: Instantiation outside constructor
Class Engine
{
}
Class Car
{
public Engine engine = new Engine();
public Car()
{
//other lines
}
}
Continue reading...
Case 1: Instantiation inside constructor
Class Engine
{
}
Class Car
{
public Engine engine;
public Car()
{
engine = new Engine();
}
}
Case 2: Instantiation outside constructor
Class Engine
{
}
Class Car
{
public Engine engine = new Engine();
public Car()
{
//other lines
}
}
Continue reading...