I'm having a little bit of a design problem with my scripting language that I'm creating for my C++ game engine. What I'm trying to do is have an object named SScript call a method to load necessary files, and check the script file's suffix. I also have a base class called SMessage than another class named SErrorMessage derives from. Here's some example code to do illustrate exactly what I want to do:
SScript::SScript(const std::string& filepath)
{
    if (load(filepath) == SError(SError::Error_Codes::ERROR_CUSTOM))
    {
    }
}
SMessage& SScript::load(const std::string& filepath)
{
}
Here's the header file for SError:
class SError : public SMessage
{
public:
    enum class Error_Codes
    {
        ERROR_CUSTOM = 1,
        ERROR_LOADING_SCRIPT = 2,
        ERROR_SCRIPT_INCORRECT_SUFFIX = 3,
    };
    SError(Error_Codes errorCode);
    SError(Error_Codes errorCode, const std::string& contents);
    virtual void message(const std::string& contents);
    inline bool operator=(const Error_Codes errorCode)
    {
    }
private:
    SError() {};
    Error_Codes m_error_code;
    void organizeString(const std::string& contents);
};
In SScript::SScript() I want to call load and compare it to various SMessages or SErrorMessages. I tried implementing an operator overload, but I don't think that will solve the problem. I've sort of hit a brick wall, and I need a serious design rethinking.
