home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c100 / 5.ddi / OVLOAD.ZIP / OV3.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1989-04-15  |  462 b   |  34 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. void foo (char x)
  16. {
  17. cout << "foo(char)\n";
  18. }
  19.  
  20.  
  21. main()
  22. {
  23. int i;
  24. char c;
  25. float f;
  26.  
  27. // Zortech test only.
  28. foo (i);  // int
  29. foo (c-32);  //i.e. char converted to upper case
  30.   //this call calls foo(int) and not foo(char).
  31. foo ((char)(c-32));  //but this one worked.
  32. foo (f);  // float becomes double
  33. }
  34.