how to implement function to check if the original value is negative and not unsigned, then after the casting it changes its value to uint.
given:
struct Object
{
uint64_t a;
string b;
}
class myclass
{
public:
bool function(const object& obj);
};
bool myclass::function(const object& obj)
{
**// if obj.a is negative number return false**
}
int main()
{
object ob;
ob.a = -5;
ob.b = "fdfdssdgdf";
myclass m;
bool boo = m.function(ob);
if(boo == false)
cout << "GOOD" << endl;
return 0;
}
Aucun commentaire:
Enregistrer un commentaire