What does it really mean , I never used HBox( some argument ); ? i saw such statement in some class inherits WindowShade control. Please clear this doubt.Thanks!
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.
That statement is a cast. It’s used when you have an object with a very generic type that you absolutely know is a more specific type – in this case, probably a DisplayObject or interface type that you know is an HBox, which you want to call the methods of HBox on.
You should only use a cast if you’re absolutely sure that you’re casting to the correct type, as casting to the wrong type will throw an error. If you’re not sure that you have an HBox, you can use the “as” syntax:
This way, if thing isn’t an HBox, myHBox will be set to null.