/*
Constructor with default argument's
*/
#include<iostream>
using namespace std;
class Sample
{
int x,y;
public:
Sample(int a,int b=100)
{
x=a;
y=b;
}
void display()
{
cout<<"\n\n X: "<<x;
cout<<"\n Y: "<<y;
}
};
int main()
{
Sample s1(10),s2(10,20);
s1.display();
s2.display();
return 0;
}
Constructor with default argument's
*/
#include<iostream>
using namespace std;
class Sample
{
int x,y;
public:
Sample(int a,int b=100)
{
x=a;
y=b;
}
void display()
{
cout<<"\n\n X: "<<x;
cout<<"\n Y: "<<y;
}
};
int main()
{
Sample s1(10),s2(10,20);
s1.display();
s2.display();
return 0;
}