Program -
#include<iostream.h>
#include<conio.h>
class abc
{
private:
int rn;
public:
void read ()
{
cout<<"\n
enter the rollno";
cin>>rn;
}
void display()
{
cout<<"\n
rollno is"<<rn;
}
};
class abc m1;
void main()
{
class abc m2;
void fun1();
m1.read();
m1.display();
m2.read();
m2.display();
fun1();
}
void fun1(void)
{
class abc m3;
m3.read();
m3.display();
}
Output :
Output :
enter the rollno 3
rollno is 3
enter the rollno 4
rollno is 4
enter the rollno 6
rollno is 6
0 comments:
Post a Comment