Unknown override specifier, missing type specifier

As @Pete Becker points out in the comments, you need to qualify the name string as std::string:

private:
    std::string constValue;
    std::string varName;

The compiler just doesn’t know what you’re talking about, and it’s the equivalent of just writing:

SomeGreatType myMagicalUniversalType

The compiler just doesn’t know what type that is unless you’ve declared, hence the error

missing type specifier – int assumed

You should read up about why you should avoid using namespace std;.

With regards to your question in the comments:

In all the (working) classes I’ve written, I’ve never put in the std::, instead relying on the using namespace std; in the .cpp file. Why would this one be any different?

I can only infer that at some point before including “Parameter.h” that you had a using namespace std. E.g.:

// SomeType.h

#using namespace std

...

// Parameter.cpp
#include "SomeType.h"
#include "Parameter.h"

The compiler compiles things top-to-bottom, and including essentially just replaces the #include with the contents of that file

Leave a Comment