Inheritance 261
void show()
{
cout<<i;
}
};
class B: private A
{
public:
void display()
{
cout<<"B class";
}
};
int main()
{
A a1;
a1.display();
}
C. What is an inheritance? What are its advantages and disadvantages?
D. Explain public, private and protected inheritance with an example.
E. Where scope resolution operator (::) is used in an inheritance class hierarchy?
F. Define Following Terms:
1. inheritance
2. base class
3. derived class
4. protected access specifier
5. virtual inheritance
G. Differentiate:
1. composition and inheritance
2.
public, private and protected inheritance
3.
private and protected access specifier
4. composition and aggregation
H. What is composition? Explain with an example.
I. Explain diamond problem and discuss a ...