Quantcast
Channel: Comments on: 7.7 — Default parameters
Viewing all articles
Browse latest Browse all 48

By: Jim

$
0
0

Alex,
This code uses the same name and parameters except one has a capital V and the other uses a lower case v.
Why wouldn’t the compiler catch this? Or is this a typo?
[code]
void printvalues(int x, int y=10);

void printValues(int x, int y=10) // error: redefinition of default parameter
{
    std::cout << "x: " << x << ‘\n’;
    std::cout << "y: " << y << ‘\n’;
}


Viewing all articles
Browse latest Browse all 48

Trending Articles