#include<iostream.h>
class item{
private:
int itemno,price;
public:
void getitemDetails(int I,int j)
{
itemno=I;
price=j;
}
void printdetails()
{
cout<<itemno<<price;
}
};
void main()
{
item k;
k.getItemDetails(3,45);
k.printdetails();
}
Output:
3 45
class item{
private:
int itemno,price;
public:
void getitemDetails(int I,int j)
{
itemno=I;
price=j;
}
void printdetails()
{
cout<<itemno<<price;
}
};
void main()
{
item k;
k.getItemDetails(3,45);
k.printdetails();
}
Output:
3 45
No comments:
Post a Comment