c++ to display the values we are passing from parameterised constructor.

//To display the values of parameterised constructor.
using namespace std;

class add
int num1,num2,sum;
public :
add(int x,int y);
void display();
add::add(int x,int y)
void add::display()
cout<<“The nummbers are “<<num1<<“t”<<num2<<“n”;
int main()
 add b=add(10,20);

OUT-The numbers are 10 20

Leave a Comment

Your email address will not be published. Required fields are marked *

Open chat