CPP
cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <iostream>
#include<string>
using namespace std;
class product
{
char n[20];
public:void get()
{
cout<<"\n enter product name:";
cin>>n;
cout<<"\t "<<n;
}
};
class edible:public product
{
char f[20];
public:void data()
{
cout<<"\n enter flavour:";
cin>>f;
cout<<"\t"<<f;
}
};
int main()
{
edible b;
b.data();
b.get();
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run