开发者

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

开发者 https://www.devze.com 2023-04-05 05:52 出处:网络
It's difficult to tell what is b开发者_运维百科eing asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current form.
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

精彩评论

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