Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialCamilleMarie Paugam
1,521 PointsUnsure how to fix the code after realizing it needs to be cast. I am having a hard time understanding its syntax
For me, I am referring to question 4 of the quiz.
1 Answer
Steven Parker
231,269 PointsThe syntax for casting is putting the target type in parentheses next to the object to be casted. Another set of parentheses might be used to enclose the cast and the object when a high-precedence operation (such as the membership operator) is being used on the object.
You might want to review the explanation and example shown in this portion of the "Casting Instances" video.
Also, when asking questions about quizzes, be aware that some of them (not this one, thankfully) randomly scramble the order each time, so you might need to give more specific information to identify the question.