bsc

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

pgrm_008.cpp (686B)


      1 /*
      2  * Author: Amit Dutta <amitdutta4255@gmail.com> | Date: 06 Jul 2026
      3  * Repo: https://github.com/notamitgamer/bsc
      4  * License: MIT
      5  */
      6 
      7 /* Function Overloading. */
      8 
      9 #include <iostream>
     10 using namespace std;
     11 
     12 class Addition {
     13     public:
     14         int add(int a, int b) {
     15             return a + b;
     16         }
     17         int add(int a, int b, int c) {
     18             return a + b + c;
     19         }
     20         float add(float a, float b) {
     21             return a + b;
     22         }
     23 };
     24 
     25 int main() {
     26     Addition obj;
     27     cout << "10 + 20 : " << obj.add(10, 20) << endl;
     28     cout << "10 + 20 + 30 : " << obj.add(10, 20, 30) << endl;
     29     cout << "12.5 + 10.5 : " << obj.add(10.5f, 12.5f) << endl;
     30     return 0;
     31 }
© notamitgamer • Site Built: 2026-07-21 13:58:23 UTC • git-mirror commit: 1037f62 [view raw info]
Originally created with stagit • modified by notamitgamer
Forked from github.com/notamitgamer/git-mirror