|
-
March 26th, 2011, 10:36 AM
#8
Re: Problem using a function from other file
 Originally Posted by imranhabib1
2. we have to call constructor of the class , (the same class whose member function we are calling) in our .cpp
This is not true.
3. adding refernce to .h file
What do you mean by "reference to .h file"?
I did 1 and 3 .. but i am confused about doing 2 ... because it has no default constructor I mean constructor with out parameters and its other constructor eg AgentActioncomponent(GameEntity* ABC)
can be used or not in my .cpp
None of what you stated makes sense.
Here is an example of code where 2) is not necessary:
Code:
#include <string>
size_t foo(std::string& s)
{
return s.length();
}
Where do you see a default constructor being called for s? That code will compile just fine. As for 3) in your description, I have no idea what you're referring to.
Regards,
Paul McKenzie
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|