In the following example:
template<class Foo>
struct FooBar
{
FooBar(Foo *pObj = 0) : pFoo_(pObj) {}
};
what does “*pObj = 0” mean?
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 means that the default value of
pObj, if the caller doesn’t provide one, is0. In this particular case, it would have been better form to useNULL(which is usually a macro of0). There are now two ways of calling it: