What is the difference between the two?
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.
A forward class declaration (class statement) simply tells the compiler a certain class exists, without specifying its methods, properties, etc. You can use a forward class declaration when you only need to declare a variable of that class, which is what you need in your header files most of the time. Then you will have to import the class in the implementation file.
Forward class declarations are particularly useful in resolving circular dependencies.
Check this out for more info: