.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to define the member function outside the class

ad+1


Program - 
 
#include<iostream.h>
#include<conio.h>
class acc
{
private:
int rollno;
char name[12];
public:
void read();
void write();
};
void acc::read()
{
cout<<"\n enter the rollno";
cin>>rollno;
cout<<"\n enter the name";
cin>>name;
}
void acc ::write()
{
cout<<"\n entered rollno is:"<<rollno;
cout<<"\n entered name is:"<<name;
}
void main()
{
class acc a1;
a1.read();
a1.write();
getch();
}


Output :
 
 enter the rollno5

 enter the name sonally

 entered rollno is:5
 entered name is: sonally


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