home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 5.ddi / OVLOAD.ZIP / OV5.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-15  |  557 b   |  33 lines

  1. #include <stream.h>
  2.  
  3. // multiple solutions, one in level 0 and one in level 1
  4.  
  5. overload foo;
  6.  
  7. void foo (int x, int y)
  8. {
  9. cout << "level 0 solution\n";
  10. }
  11.  
  12.  
  13. void foo (char c, double d)
  14. {
  15. cout << "level 1 solution\n";
  16. }
  17.  
  18. main()
  19. {
  20. char c;
  21. int i;
  22. foo (c,i);
  23. // level 0 solution:  char exact match for int
  24. // level 1 solution:  int converted to double
  25.  
  26. // Zortech causes syntax error:
  27. //     cannot uniquely determine which function 'foo' to call
  28. // and no code generated.
  29.  
  30. // Guidelines gives level 0 solution with no warnings.
  31.  
  32. }
  33.