Consider the following Inheritance in C++ : class Person
Consider the following Inheritance in C++ :
class Person
{
char AadharNo[12];
protected :
char Name[20];
public :
______
______
void Readdata( );
};
class Student : public Person
{
int Grade;
public :
______
______
};
What will be the visibility mode of Name and Readdata ( ) in the derived class student ?
Show answerHide answer
Correct answer: (B) Name → Protected, Readdata → Public
Explanation
With public inheritance, protected members stay protected and public members stay public in the derived class. So Name is protected and Readdata() is public. The private AadharNo is not accessible in Student.