Program -
#include<iostream.h>
#include<conio.h>
class abc
{
private:
int rn;
float fee;
public:
abc()
{
rn=20;
fee=286;
}
void dispdata()
{
cout<<"\n
rollno is"<<rn;
cout<<"\n
fee is"<<fee;
}
~abc()
{
cout<<"destructor
invoked";
}
};
void main()
{
clrscr();
class abc a;
a.dispdata();
getch();
}
Output -
Roll no is 20
fee is 286
0 comments:
Post a Comment