PRASHNIKAप्रश्निका
‹ Back to the paper

What will happen if data members of super class are made private instead of protected?

Computer Science20251 markShort answer

Answer

Answer

AI
If the data members of the super class are made private, they become inaccessible directly in the subclass. The subclass would no longer be able to refer to colour and registration by name in its own methods; it would have to use public getter/setter (accessor/mutator) methods of the super class to access or change them.
Inheritance, Interfaces and Polymorphism

From ISC Computer Science - Competency Focused Practice Questions (CISCE, August 2024), question 27.