0

我在两个不同的未命名命名空间中的两个函数有一个重新定义问题,每个函数都放在两个单独的文件中。

第一个函数分组在一个文件中:

namespace
{
    bool isValid();
}

. . .

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

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

然后部分功能分组在另一个文件中:

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);
}
}

但是在我的应用程序文件中,程序说我对函数 isValid() 有重新定义问题。你们能告诉我如何解决这个问题吗?

4

0 回答 0