diff --git a/CPP/questions/SingleInheritance.cpp b/CPP/questions/SingleInheritance.cpp new file mode 100644 index 00000000..99daa7f5 --- /dev/null +++ b/CPP/questions/SingleInheritance.cpp @@ -0,0 +1,55 @@ +#include +using namespace std; +class person +{ + protected: + string aa; + public: + string name; + int age; + void get_p() + { + cout<<"Enter Name\n"; + cin>>name; + cout<<"Enter age\n"; + cin>>age; + } + void display_p() + { + cout<<"Name is "<get_p(); + cout<<"Enter coursename\n"; + cin>>courseName; + cout<<"Enter id\n"; + cin>>id; + } + void display_s() + { + this->display_p(); + cout<<"CourseName is "<name.empty()) + cout<<"Hello"; + s->get_s(); + s->display_s(); + person p; + cout<name; +}