bsc

Comprehensive codebase and cou...
Log | Files | Refs | Activity | README | LICENSE

root / semester_2 / eduincs / pgrm_008.cpp

pgrm_008.cpp (550B)


      1 /* Function Overloading. */
      2 
      3 #include <iostream>
      4 using namespace std;
      5 
      6 class Addition {
      7     public:
      8         int add(int a, int b) {
      9             return a + b;
     10         }
     11         int add(int a, int b, int c) {
     12             return a + b + c;
     13         }
     14         float add(float a, float b) {
     15             return a + b;
     16         }
     17 };
     18 
     19 int main() {
     20     Addition obj;
     21     cout << "10 + 20 : " << obj.add(10, 20) << endl;
     22     cout << "10 + 20 + 30 : " << obj.add(10, 20, 30) << endl;
     23     cout << "12.5 + 10.5 : " << obj.add(10.5f, 12.5f) << endl;
     24     return 0;
     25 }
© notamitgamer • Site Built: 2026-09-05 01:53:16 UTC • git-mirror commit: c170d72 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror