Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Two parameter declarations that differ only in their default arguments are equivalent.
- #include <cstdio>
- void func(double i);
- void f(int i, int j);
- void f(int i, int j = 99); // OK: redeclaration of f(int, int)
- void f(int i = 88, int j); // OK: redeclaration of f(int, int)
- void f(); // OK: overloaded declaration of f
- void prog()
- {
- f(1, 2); // OK: call f(int, int)
- f(1); // OK: call f(int, int)
- // f(); // error: f(int, int) or f() ?
- }
- int main(int argc, char const* argv[])
- {
- prog();
- return 0;
- }
- void f(int i, int j)
- {
- printf("i=%d, j=%d\n", i, j);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement