I\'m not too familiar with c++ and how instantiating objects work, so this is probably a very simple thing to solve. When I compile with g++ I get the error \" undefined re
You're probably not including Foo.cpp in your compile line. It should look something like this:
g++ main.cpp Foo.cpp -o testFoo
Not related to the problem you were having but consider making a couple minor changes:
Pass the argument in a const reference. const because you do not plan on changing the value of the argument and reference so that you do not create any additional temporary objects.
C++ has an initializer concept that is more efficient then using the assignment operator on member 'id' in the body of the constructor. The current version of the constructor will call member id's default constructor and then its assignment constructor. The initializer concept (i.e. 'id(s)') will just call one method the copy constructor.
Foo::Foo(const string& s) : id(s)
{
}