I want a property that will only accept float values between 0 and 1. I could do that in a standard way by defining float_t or double_t type for the property, but doubting, are there more elegant ways for that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do it the standard way – define a
double/floatproperty and check for validity in the setter – example: