//myClassInheritance1.cpp #include #include using namespace std; class A{ public: string greetings ; void record(string str1); }; void A::record(string str1) { cout<<"\n "<< " " << str1; } class B:public A{};// scope public is required struct C: A{};// in struct scope is public by default int main() { B b;C c; b.greetings="welcome"; cout<<"\n "<< b.greetings; b.record("Manas"); c.record("from USA"); return 0; }