1.

If protected inheritance is used then _____(a) Public members become public in subclass(b) Protected members become public in subclass(c) Protected members become protected in subclass(d) Protected and Public members become protected in subclassThe question was asked during a job interview.Question is from Protected Access Specifier topic in section Access Specifiers of Object Oriented Programming

Answer»

The correct ANSWER is (d) Protected and Public MEMBERS become protected in subclass

The explanation: The protected and public members of the parent class will become the protected members in subclass. This is predefined RULE of inheritance. The REASON behind is to maintain the level of security in subclass too.



Discussion

No Comment Found

Related InterviewSolutions