Constructor question...

Started by
3 comments, last by JamesKilton 19 years, 4 months ago
In a constructor can I assign a standard string object like this?

ScreenEntityAnimation::ScreenEntityAnimation(string Input):FileLocation(Input)
{
   // yadda yadda
}

Or do I need to copy it explicity? Thanks in advance. Mark Coleman
Advertisement
Sure you can, it will use the copy constructor of the string instead of using the default constructor + assignment operator.
You can always do that if there is a constructor for the object matching what you put. You can even put a parent class's constructor there with arguments.
Thanks guys, I am getting strange errors and I am just trying to rule things out to get to the bottom of it...
What you have posted above is correct. What errors are you getting?

This topic is closed to new replies.

Advertisement