summaryrefslogtreecommitdiff
path: root/6p51.cpp
diff options
context:
space:
mode:
authorOskar <[email protected]>2024-09-16 14:39:48 +0200
committerOskar <[email protected]>2024-09-16 14:39:48 +0200
commitdf2ff7d92c25269d05a0bae75e0de8abd63a23d0 (patch)
tree8e1e518003680c768e5d9c531531b29f763da621 /6p51.cpp
parent8644ec6252d2ec44d8a549253049f3a0de2c9494 (diff)
more
Diffstat (limited to '6p51.cpp')
-rw-r--r--6p51.cpp48
1 files changed, 48 insertions, 0 deletions
diff --git a/6p51.cpp b/6p51.cpp
new file mode 100644
index 0000000..96f7dd4
--- /dev/null
+++ b/6p51.cpp
@@ -0,0 +1,48 @@
+#include <iostream>
+
+/*
+ *
+ * 6.51
+ *
+ *
+ */
+
+void f() {
+
+ std::cout << "f()" << std::endl;
+}
+
+void f(int i) {
+
+ std::cout << "f(int) " << i << std::endl;
+}
+
+void f(int i, int j) {
+
+ std::cout << "f(int, int) " << i << " " << j << std::endl;
+}
+
+void f(double a, double b = 3.14) {
+
+ std::cout << "f(double, double) " << a << " " << b << std::endl;
+}
+
+int main () {
+
+ /*
+ 1 // void f();
+ 2 // void f(int);
+ 3 // void f(int, int);
+ 4 // void f(double, double = 3.14);
+
+ (a) ambiguous?
+ (b) 2
+ (c) 3
+ (d) 4
+ */
+ // f(2.56, 42); Ambiguous
+ f(42);
+ f(42, 0);
+ f(2.56, 3.14);
+ return 0;
+}