Hello,
I want a virtual class like this:
class Configuration
{
public:
enum EPromptId;
virtual CString getPrompt( EPromptId promptId ) = 0;
private:
};
So that each derived configuration can have its own set of EPromptIds
class Configuration1 : public Configuration
{
public:
enum EPromptId{
epid_HappyBirthday
};
CString getPrompt( EPromptId promptId ){
return "";
}
private:
};
class Configuration2 : public Configuration
{
public:
enum EPromptId{
epid_JummpingJehoshaphat
};
CString getPrompt( EPromptId promptId ){
return "";
}
private:
};
This fails as each class needs to implment a virtual function with a Configuration::EPromptId parameter (not a Configuration1::EPromptId or Configuration2::EPromptId as in this code).
Is it possible to get the base class to recognise the parameter type but define the values differently in each derived class (perhaps not using enums, but keeping it strongly typed, i.e. not using an int).
EDIT : I want two different configurations for two different 'applications'. The prompts could be held in a db table but each 'application' will have it's own table. A pointer to the base configuration class is contained in a class which interfaces to some hardware (i.e. which does the actual displaying). The hardware is an io device that can be used to request and receive user input. When the hardware class is created it will be passed a pointer to the correct configuration class and so display the right prompts when requested.