Program -
#include<iostream.h>
#include<conio.h>
class abc
{
clrscr();
public:
int a;
void read(void )
{
cin>>a;
}
void display()
{
cout<<a;
}
};
void main()
{
void fun();
class xyz
{
public:
int x;
void read(void)
{
cin>>x;
}
void display()
{
cout<<x;
}
};
class abc m1;
class xyz m2;
m1.a=20;
m1.read();
m1.display();
m2.x=25;
m2.read();
m2.display();
fun();
}
void fun()
{
class abc m3;
class xyz m4;
m3.a=30;
m3.read();
m3.display();
}
Output
202530
0 comments:
Post a Comment