I saw this constructor:
MyClass(class MyOtherClass* = 0) {}
What does the class keyword mean? Does the constructor take a MyOtherClass pointer and defaults the argument to the null pointer?
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.
It’s a forward declaration.
MyOtherClassdoesn’t have to be defined before use in this context, so a forward declaration is enough. The=0is the default value for the argument.Braindump of the cases where you don’t need a full definition:
Compare the following: