Q.Answer the questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →Part (a): the example is multilevel inheritance; visibility of members through the chain depends on the access specifiers, giving the accessible-member lists below. Part (b): a protectedly-derived FrontOffice class with the required data members, a constructor, Assign() and Display().
Part (a)
The chain is Ground → Middle (private derivation) → Top (public derivation).
(i) Type of inheritance: one class derived from another which is derived from a third → Multilevel Inheritance.
(ii) Members directly accessible inside Give() of Middle:
- Middle's own members:
Labs,Take(),Give(). - Inherited from Ground (private derivation): Ground's public
Get()and protectedPut()become private members of Middle, so they are accessible within Middle's own methods. - Ground's private
Roomsis never accessible. →Labs, Take(), Give(), Get(), Put().
(iii) Members directly accessible inside Out() of Top:
- Top's own members:
Roof,In(),Out(). - Inherited from Middle (public derivation): Middle's public
Take(),Give()remain accessible; Middle's privateLabsis not. Get()/Put()had become private in Middle, so they are not inherited-accessible in Top. →Roof, In(), Out(), Take(), Give().
(iv) Members accessible to object T of Top in main():
An object can use only public members. Top's public members are In(), Out(); through public derivation Middle's public Take(), Give() are also public in Top. Everything from Ground is private in Middle, hence unavailable. …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.