Q: What is the recommended way to store default values for a class with many variants? I have a class that has several properties and the default property values change depending on a parameter.
Take for example we have a car class as below.
class Car {
    public:
        Car(int model);
        ~Car();

        int getFuelTankCapacity() const;
        void getTorque();
        void getCC();

    private:
        int fuelTankCapacity;
        int cc;
        int torque;
};

Assume we want to initialize the Car object based on the model number when created and assume there are 30 or more models. What is the right way to do? Should we have something like below?
Car::Car(int model)
{
    switch(model) {
        case swift:
            .....
        case rover:
            .....
    }
}

Or we should use factory class? I feel that factory class is not suitable as the models are too many. Any suggestions?
I just started working on C++ based project. Please forgive me and help.
Here is a slight variant of the above example. I saw only option to edit to add more info. Please suggest, if this is not correct.
Assume that we need to write an application for a range of mobile phones and want to have the same firmware. Assume all phones have the same processor and the difference is only in the interfacing devices like sensors, camera resolution, etc.
Assume that I am going to create classes for the proximity sensor, camera.
When booted, the application should get predefined capability based on the model(assuming the application can somehow fetch model). Once the model is known, it should initialize the objects with default values.
typedef enum _model_e {
    eMOB12MP,
    eMOB8MP,
    eLASTMODEL
};

typedef struct _camera_info_t {
    resolution_e res;
    ..........
}camera_info_t;

typedef struct _prox_sensor_t {
    bool supported;
    ........
}prox_sensor_t;

typedef struct _config_t {
    camera_info_t cam;
    prox_sensor_t prox;
    ....
}config_t;

static const config_t configs[] =
{
    { // model eMOB12MP
        .cam =
         {
            .res = 12MP,
            ........
         },
        .prox = 
         {
            .supported = false,
            ............
         },
         ........
    },
    { //eMOB8MP
        .cam =
        {
            .res = 8MP,
            ........
        },
        .prox =
        {
           .supported = true,
           ............
        },
        ........
    },
}

config_t *get_config(model_e model)
{
    config_t *ptr = NULL;

    if (model < eLASTMODEL && model >= 0) {
        ptr = configs[(int)model];
    }

    return ptr;
}

In the main function, I will call get_config() and initialize all the objects based on the config. The only reason the above approach is proposed because, whenever new model gets added which can be supported with the same firmware, changes needs to be done in one place. Is this correct?
Thanks,
Subbarao

A: This sounds like a use case for a Factory Pattern. The example in wiki (PHP one, but still usefull to get the idea) even uses cars.
You could implement a variant which uses a register method, where you register your ~30 models in the factory. The factory then uses proper default values for creating your instance. These default values need to be given to the factory somewhere (most likely in a separate header file)
