Reputation: 2268
In my Class i have a boolean variable
class Sum_SystemTagControlVisitor : public FunctionVisitor
{
private:
std::string variableName;
std::string variableValue;
std::string variableValue1;
bool m_bIsTimer{ false };
public:
Sum_SystemTagControlVisitor(std::string varName, std::string varValue ) : variableName(varName), variableValue(varValue) { }
Sum_SystemTagControlVisitor(std::string varName, std::string varValue , bool isTimer) : variableName(varName), variableValue(varValue) , m_bIsTimer(isTimer){ }
Sum_SystemTagControlVisitor(std::string varName, std::string varValue, std::string varValue1) : variableName(varName), variableValue(varValue), variableValue1(varValue1) { }
virtual void visit(Sum_TagControl& tagControl ) override;
};
Only one of the constructor is able to set the boolean value and for the other two constructors will it be always be false ?
Upvotes: 2
Views: 55
Reputation: 409146
Inline initialization of member variables will always take place, unless your initializer list contains an entry for that variable.
So in short: For the constructor that doesn't initialize the variable, it will be automatically initialized to false
.
Upvotes: 1