Files
DEC/DEC_GUI/DEC-0.0/individual/Trait.cpp
2024-10-03 18:43:04 +07:00

31 lines
826 B
C++

#include "Trait.h"
#include <iostream>
//Trait::Trait(const Trait& _t)
//{
// *this = _t;
//}
Trait::Trait(Trait::idType _ID, std::string _name, float value):
ID(_ID), name(_name), traitValueCont(value), traitType(Continious)
{}
Trait::Trait(Trait::idType _ID, std::string _name, int value):
ID(_ID), name(_name), traitValueDiscr(value), traitType(Discrete)
{}
void Trait::setTraitValue(float _value){
if(this->traitType == Continious){
this->traitValueCont = _value;
return;
}
/*throw*/std::cerr<<"Trait.cpp(17) Warning: can't assign float value to discrete trait\n";
}
void Trait::setTraitValue(int _value){
if(this->traitType == Discrete){
this->traitValueDiscr = _value;
return;
}
/*throw*/std::cerr<<"Trait.cpp(25) Warning: can't assign int value to continious trait\n";
}