I have this class
class Field
{
public:
Field();
~Field();
Field(const std::string& nameP,
const int idP ,
const std::map<int,Field*> sequence=std::map<int,Field*>(),
const std::string& constval="",
const std::string& presP="");
std::string f_name;
int f_id;
std::string f_presence;
std::string f_const;
std::map<int,Field*> f_set;
};
the problem is that my Class Field can be a set of other fields that's why I've used the map , or it can be a constant value that's why I used the const, or it could be neither so I used 3 different constructor , but the compiler refuses them telling me "C++ Ambiguous call to overloaded Field... Candidates are ...) so now I tried to put all possibilities in one but the compiler once again giving me loads of errors since my last three fields. So anyone can tell me what should I do to have my three possible constructors ?? PS: I really need to know the answer about this ambiguity call so please no inheritance suggestion please ! ps the previous code causing the error is this
class Field
{
public:
Field();
~Field();
Field(const std::string& typeP,
const std::string& nameP,
const int idP ,
const std::string& presP="");
Field(const std::string& typeP,
const std::string& nameP,
const int idP ,
const std::string& constval,
const std::string& presP="");
Field(const std::string& typeP,
const std::string& nameP,
const int idP ,
const std::map<int,Field*> sequence ,
const std::string& presP="");
/// field attributes
std::string f_type;
std::string f_name;
int f_id;
std::string f_presence;
std::string f_const;
std::map<int,Field*> f_set;
};