-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexam 17.cpp
More file actions
33 lines (27 loc) · 867 Bytes
/
exam 17.cpp
File metadata and controls
33 lines (27 loc) · 867 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
//1.Create a class to print the sum of numbers.
//2.The class has two methods with the same name but different types and number of parameters.
//3.One method for printing sum has two parameters of integer and long type while the other method for printing sum has three parameters of type int.
//4.Now call the method with two integer parameters and check which method gets called.
#include <iostream>
using namespace std;
#include <iostream>
using namespace std;
class student
{
public :
void display(int a, long b)
{
cout << a+b<<endl<<"Number 1 Method has been called"<<endl;
cout << "_______________________";
}
void display(int c,int d, int e)
{
cout <<c+d+e<<endl<<"Number 2 Method has been called";
}
};
int main ()
{
student ob;
ob.display(5,8);
return 0;
}