开发者

Two structures with the same name, how do u choose one? [closed]

It's difficult to tell what is b开发者_运维百科eing asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have

int function(string n){

vector<int> n;


}

I want to call functions using the vector n, but..for some reason it keeps calling the string n functions..I thought it would call the closest dat


int function(string n){
    {
        vector<int> n;
        n.size(); //vector!
    }
    n.size(); //string!
}

Although really, just rename the variable. Don't ever have variables with the same name in the same scope. Ever. People will hate you, and then there's all those nasty surprises in the afterlife.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜