Skip to main content
gamedev.net
🔒 Locked

Constructor question...

Started by mrmrcoleman Dec 3, 2004 at 8:32 AM 3 replies 450+ views
Original Post
mrmrcoleman
mrmrcoleman
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
Aldenar
Aldenar
Sure you can, it will use the copy constructor of the string instead of using the default constructor + assignment operator.
Puzzler183
Puzzler183
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.
mrmrcoleman
mrmrcoleman
Thanks guys, I am getting strange errors and I am just trying to rule things out to get to the bottom of it...
JamesKilton
JamesKilton
What you have posted above is correct. What errors are you getting?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.