Pages

Sunday, May 11, 2025

Function Overloading in OOPs

 #include <iostream>

using namespace std;

class Print {
public:
    void show(int x) {
        cout << "int: " << x << endl;
    }    

    void show(string str) {
        cout << "string: " << str << endl;
    }

};

int main() {
    Print ob1;
    ob1.show(25);
    ob1.show("apna college");

    return 0;
}

OUTPUT:-
int: 25 string: apna college

No comments:

Post a Comment

how to become red on codeforces by Errichto Algorithms | explained simply in a blog

 Yes. I found an available transcript of the video and summarized it simply. The video is “How To Become Red Coder? (codeforces.com)” by Err...