summaryrefslogtreecommitdiff
path: root/reference/CPLUSPLUS/EXAMPLES/overload.cc
blob: cd8a720730ca569303bd839e3da4a05ddd7f0912 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
    
   #include <iostream.h>
    
    void Add(int Left,   int Right);
    void Add(double Left, double Right);

    main ()
    {
        
        Add(5, 9);
        Add(3.2, 7.1);
    }
 
    // integer version of Add.
       
    void Add(int Left, int Right)
    {
        cout << Left << " + " << Right << " = " << Left+Right << endl;
    }
    
    // float version of Add.
    
    void Add(double Left, double Right)
    {
        cout << Left << " + " << Right << " = " << Left+Right << endl;
    }