Example
#include<iostream.h>
#include<conio.h>
class demo3
{
int x,d;
public:
demo3(int a,int b)
{
x=a;
d=b;
}
float display(demo3 y)
{
cout<<"multiplication of two number::"<<y.x*y.d;
}
};
int main()
{
clrscr();
int a,b;
cout<<"Enter two number::"<<endl;
cin>>a>>b;
demo3 d1(a,b),d2(a,b);
d1.display(d2);
getch();
return 0;
}
/*=====================================================================
output
Enter two number::
3
4
multiplication of two number::12
*/
#include<iostream.h>
#include<conio.h>
class demo3
{
int x,d;
public:
demo3(int a,int b)
{
x=a;
d=b;
}
float display(demo3 y)
{
cout<<"multiplication of two number::"<<y.x*y.d;
}
};
int main()
{
clrscr();
int a,b;
cout<<"Enter two number::"<<endl;
cin>>a>>b;
demo3 d1(a,b),d2(a,b);
d1.display(d2);
getch();
return 0;
}
/*=====================================================================
output
Enter two number::
3
4
multiplication of two number::12
*/
No comments:
Post a Comment