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

  1. #include <stream.hpp>
  2. overload foo;
  3.  
  4. void foo (int x)
  5. {
  6. cout << "foo(int)\n";
  7. }
  8.  
  9.  
  10. void foo (double x)
  11. {
  12. cout << "foo(double)\n";
  13. }
  14.  
  15. main()
  16. {
  17. int i;
  18. char c;
  19. float f;
  20.  
  21. foo (i);  // int
  22. foo (c);  // char becomes int
  23. // Zortech gives syntax error: cannot tell which function foo() to call
  24. foo (f);  // float becomes double
  25. }
  26.