You've correctly prototyped your methods within the class, so redefining your class to implement the methods are wrong. Remove the duplicate class, all you need to do is define them as such in your foo.cpp file:
foo::foo() { .. }
foo::~foo() { .. }
void foo::test() { .. }