Make the following changes:
//.h
public:
Constructor(int thing);
static bool validateThing(int thing);
//.cpp
Class::Constructor(int thing): m_thing(thing)
{
PRECONDITION(validateThing(thing));
//etc.
}
bool Class::validateThing(int thing)
{
//implement here
}
It appears you did not provide an implementation of validateThing
. You should also make sure declarations and definitions agree on types of parameters (const
/non-const
, references etc.) and initialize members correctly.
Functions like the constructor and validateThing
should take const&
arguments. But for simple types like int
you can also pass by value.