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

  1. #include <stream.hpp>
  2.  
  3. // test level 1 search.
  4. // if no exact match, convert int to long, int to double,
  5. // or pointer & reference conversions.
  6.  
  7. overload foo;
  8.  
  9. void foo (long x)
  10. {
  11. cout << "foo(long)\n";
  12. }
  13.  
  14.  
  15. void foo (double x)
  16. {
  17. cout << "foo(double)\n";
  18. }
  19.  
  20. main()
  21. {
  22. long l;
  23. double d;
  24. int i;
  25. float f;
  26.  
  27. foo (l);  //long
  28. foo (d);  //double
  29. foo (i);
  30.    // Guidelines causes warning: 2 standard conversion possible for foo()
  31.    // and it chose foo(long)
  32.    // Zortech causes error, and does not generate code.
  33. foo (f);  //float converted to double
  34. }
  35.