Error in Construct code

Hi All,

I would like to know what is the error in the following program, when I compile it shows me syntax error I have done everything to rectify up to my knowledge but I couldn’t so pls help me.

public static Car construct(CarGroup carGroup)
{
Car car;
;
switch (carGroup)
{
case CarGroup::Economy :
car = new Car_Economy();
break;
case CarGroup::Compact :
car = new Car_Compact();
break;
case CarGroup::MidSize :
car = new Car_MidSize();
break;
case CarGroup::Luxury :
car = new Car_Luxury();
break;
}
return car;
}

Regards,

Naveen

Please, if you get a compilation error, never forget to tell us the error message and on which line it occurs.

I don’t see anything syntactically wrong in your code, but it assumes certain enum elements, classes and parameterless constructors. If you get a compilation error, one of these assumptions in probably wrong.