Set min/max value for a field - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Set min/max value for a field

sk37chsk37ch Posts: 1Member
Is it possible to set a minimum and maximum possible value for an integer field? Can I do it within the contructor? I have googled it but everything I find seems for more advanced and technical than what I am looking for.

I am trying to set a minimum of "0" and a maximum of "10" for the field "happiness".
public Tux()
{
x = 0;
y = 1;
z = 5;
texture = "models/tux/tux.png";
model = "models/tux/tux.obj";

//Additional fields added for "Peppy"
hunger = 5;
happiness = 5;
thirst = 0;
}
Sign In or Register to comment.