.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ program to declare the local object

ad+1

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

Home About-us Privacy Policy Contact-us Services
Copyright © 2014 All Programs Examples | All Rights Reserved. Blogger Templates Download Blogger Templates