Redefinition error in different unnamed spaces

216 views Asked by At

I have a redefinition problem with two functions in two different unnamed namespaces, which each is placed in two separate files.

The first function grouping is in a one file:

namespace
{
    bool isValid();
}

. . .

namespace
{
    bool isValid()
    {
        string copyName = Authenticate::getUserName();

        return (copyName.length() == 8);
    }
} 

And then the section function grouping is in another file:

namespace
{
    bool isValid()
}

. . .

namespace
{
    bool isValid()
    {
    string copyPass = Authenticate::password;
    bool eightChar = false;
    bool size = false;

    for (int index = 0; index < copyPass.length(); index++)
    {
        if (isdigit(copyPass[index]))
            eightChar = true;
    }

    if (copyPass.length() >= 8)
        size = true;

    return (eightChar && size);
}
}

but in my application file, the program says that I have a redefinition problem with the function isValid(). Can you guys please let me know how I can fix this problem?

0

There are 0 answers