Sorry, I may be lacking in terminology, but my searches haven't provided any answer despite the trivial question. Here goes -
I have a superclass and wish to be able to create a new object of any of the subclasses with a method like the the following:
static void AddNewVehicle(string brand, string model, int year, int price)
{
V.Add(new Car(brand, model, year, price));
}
I imagined that I would be able to do it like this:
static void AddNewVehicle(object VehicleType, string brand, string model, int year, int price)
{
V.Add(new VehicleType(brand, model, year, price));
}
...but I'm getting the following error:
"The type or namespace name 'VehicleType' could not be found (are you missing a using directive or an assembly reference?)"