Извиняюсь за то, что не смог опубликовать какой-либо код для этой проблемы, так как я очень плохо знаком с C ++.
У меня есть класс
class Container
{
private:
std::string stdstrContainerName;
std::string stdstrPluginType;
int iSegments;
float fRadius;
public:
Container();
Container(std::string , std::string , int , float);
Container(const Container& obj);
~Container();
std::string GetName();
std::string GetType();
void SetName(std::string stdstrName);
};
Я хочу изменить параметрОбъект класса, использующий функцию.
void ChangeParameter( Container cont , std::string strParameterName ,
value( "which can be either string or int" ));
Void Container::Set( std::string strParamValue , std:string Value)
{
if( strParamValue == "stdstrContainerName" )
stdstrContainerName = Value;
if( strParamValue == "stdstrPluginType" )
stdstrPluginType = Value;
}
Могу ли я иметь функцию, в которой мне не нужно использовать условия