INHERITANCE IN C++ (10)
Consider the following code and answer teh questions that are given below:
class B
{
int A1;
void BFunc1{};
protected:
int B1;
void BFunc2();
public:
int C;
void BFunc3();
}0b1;
class M:private B
{
int A2;
protected:
int B2;
void MF1();
public:
int C2;
void MF2();
}0b2;
class D:protected M
{
void DF1();
int A3;
public:
int B3;
void DF2();
}0b3;
(i) Which type of inheritane is shown in the above example?
(ii) Write name of the data memebers that are accessible in function DF1{}.
(iii) What would be the size of class D object?
(iv) Name the data members that are accessible in function MF1() of class M.
class B
{
int A1;
void BFunc1{};
protected:
int B1;
void BFunc2();
public:
int C;
void BFunc3();
}0b1;
class M:private B
{
int A2;
protected:
int B2;
void MF1();
public:
int C2;
void MF2();
}0b2;
class D:protected M
{
void DF1();
int A3;
public:
int B3;
void DF2();
}0b3;
(i) Which type of inheritane is shown in the above example?
(ii) Write name of the data memebers that are accessible in function DF1{}.
(iii) What would be the size of class D object?
(iv) Name the data members that are accessible in function MF1() of class M.
No comments
Post your comments