I have my class Stack
class Stack
{
public:
Stack(unsigned int Size)
{
size = Size;
}
private:
unsigned int size;
void* Block;
};
int _tmain(int argc, _TCHAR* argv[])
{
Stack x(-1);
return 0;
}
I want to make sure that even I pass negative value to the constructor argument that the object wont be constructed , but when I'm giving -1 value , it's accepting it and the variable size value is 4294967295 , which is the same -1 after removing the sing bit as far as I know ...
so how I shall handle this situation ? shall I throw exception ? or just make to take default value in case of wrong value ?