.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to declare the global class

ad+1


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

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