How many private members does an object of class D have?
Consider the class inheritance.
```
class B
{
public:
B();
B(int nn);
void f();
void g();
private:
int n;
};
class D: public B
{
public:
D(int nn, float dd);
void h();
private:
double d;
};
```
a) 0
b) 1
c) 2
d) 3
e) 4
f) 5
c) 2
Member functions of class D cannot directly access private members of the base class. Nevertheless, publicly inherited public member functions of the base class (which are public in the derived class) can be called by derived class objects. These base class member functions can access base class private members, so the base class private members must be present in a derived object.
Computer Science & Information Technology