Program -
#include<iostream.h>
#include<conio.h>
class sum
{
private:
int rollno;
public:
void readdata(int
rn)
{
rollno=rn;
}
void display()
{
cout<<rollno;
}
};
void main()
{
clrscr();
class sum d1,d2;
d1.readdata(121);
d2.readdata(1325);
cout<<"\n
rollno of bca-1 is: ";
d1.display();
cout<<"\n
rollno of bca-2 is:";
d2.display();
getch();
}
Output :
rollno of bca-1 is: 121
rollno of bca-2 is:1325
0 comments:
Post a Comment