Untitled
unknown
plain_text
a year ago
914 B
2
Indexable
Never
#include<iostream> using namespace std; class person { protected: int id; char name[10]; public: void read() { cout<<"\n enter id and name:"; cin>>id>>name; } void show() { cout<<"\n id="<<id; cout<<"\n name="<<name; } }; class stu :public person { private: int marks; public: void read1() { read(); cout<<"\n marks="<<marks; cin>>marks; } void show1() { show(); cout<<"\n marks="<<marks; } }; class emp : public person { private: float sal; public: void read1() { read(); cout<<"\n enter salary:"; cin>>sal; } void show1() { show(); cout<<"\n salary="<<sal; } }; int main() { person p; p.read(); p.show(); stu s; s.read1(); s.show1(); emp e; e.read1(); e.show1(); }