Is there a cast keyword in Objective-C like C# (as):
Foo bar = new Foo();
Foo tmp = bar as Foo;
Is this possible in Objective-C?
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.
There is no direct equivalent of
asin Objective-C. There is regular type casting (C-style).If you want to check the type of the object, be sure to call
isKindOfClass:.To write the equivalent of:
You’d write:
You could always write this up as a category like:
Then you could write it like: