Friday, 27 April 2012

Program Of Conversion Between Objects To Basic Type

#include<iostream.h>
#include<conio.h>
class add
{
private:
int a,b;
public:
add(int x)
{
a=x;
}

{
return a;
}

void show()
{
cout<<"a is="<<a;
}
};
main()
{
clrscr();


------- Object to BAsic ------ 

int r;
add a1(4);
a1.show();
r=a1;
cout<<"\n Value of r="<<r;
getch();
}

No comments:

Post a Comment