Firkraag
unread,Jan 7, 2012, 5:16:11 AM1/7/12You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hi, consider the following code:
class Bicycle : Vehicle {}
class Truck : Vehicle {}
abstract class Vehicle
{
public abstract void Move(int x, int y);
public static Vehicle Make(int choice)
{
if (choice == 1)
{
return new Bicycle();
}
else if (choice == 2)
{
return new Truck(int howManyWheels); // ?
}
...
}
}
Maybe I am missing something obvious, but what would be the best way
to handle constructors with various number of arguments here?