-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFunctionOverloading.cpp
More file actions
45 lines (40 loc) · 1000 Bytes
/
Copy pathFunctionOverloading.cpp
File metadata and controls
45 lines (40 loc) · 1000 Bytes
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#include<iostream>
using namespace std;
class Demo
{
public:
// Overloading by changing number of parameters
// fun@2ii
void fun(int i, int j) // fun(11,21)
{}
// fun@3iii
void fun(int i, int j, int k) // fun(11,21,51)
{}
// Overloading by changing sequance of parameters
// gun@2id
void gun(int i, double d) // gun(10, 10.5)
{}
// gun@2di
void gun(double d, int i) // gun(10.5, 10)
{}
// Overloading by changing datatype of parameters
// sun@2cc
void sun(char ch1, char ch2) // sun('a','b')
{}
//sun@2ff
void sun(float f1, float f2) // sun(10.5f, 20.5f)
{}
/*
// We cant Overload by changing return type
// run@2ii
int run(int i, int j)
{}
// run@2ii
float run(int i, int j)
{}
*/
};
int main()
{
return 0;
}