home *** CD-ROM | disk | FTP | other *** search
- #include <stream.h>
- overload foo;
-
- void foo (char x)
- {
- cout << "foo(char)\n";
- }
-
-
- void foo (int x)
- {
- cout << "foo(int)\n";
- }
-
- // warning that overloading mechanism cannot tell void(char ) from void(int )
-
- void foo (double x)
- {
- cout << "foo(double)\n";
- }
-
- main()
- {
- int i;
- char c;
- float f;
-
- foo (i); // int becomes char with no warning
- foo (c); // char
- foo (f); // float becomes double
- }
-
- // This test and test 2 indicates that when the functions cannot be
- // distinguished on "exact match", the first one is used.
-