1.

If a base class is inherited in protected access mode then which among the following is true?(a) Public and Protected members of base class becomes protected members of derived class(b) Only protected members become protected members of derived class(c) Private, Protected and Public all members of base, become private of derived class(d) Only private members of base, become private of derived classI had been asked this question by my school teacher while I was bunking the class.I would like to ask this question from Inheritance topic in section Inheritance & its Types of Object Oriented Programming

Answer»

Right option is (a) PUBLIC and Protected members of base class BECOMES protected members of derived class

The explanation: As the programming language rules apply, all the public and protected members of base class becomes protected members of derived class in protected ACCESS mode. It can’t be changed because it would HINDER the security of data and may ADD vulnerability in the program.



Discussion

No Comment Found

Related InterviewSolutions