.
Home About-us Privacy Policy Contact-us Services

Thursday, October 8, 2015

C++ Program to show relationship of class and object

ad+1

Program - 
 
#include<iostream.h>
#include<conio.h>
class sum
{
private:  
int rollno;
public:
void readdata(int rn)
{
rollno=rn;
}
void display()
{
cout<<rollno;
}
};
void main()
{
clrscr();
class sum d1,d2;
d1.readdata(121);
d2.readdata(1325);
cout<<"\n rollno of bca-1 is: ";
d1.display();
cout<<"\n rollno of bca-2 is:";
d2.display();
getch();
}
  
Output :

 rollno of bca-1 is: 121
 rollno of bca-2 is:1325



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