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

You might also like to view...

A T1 line represents more line capacity than an E1 line

Indicate whether the statement is true or false

Computer Science & Information Technology

The Date function has the form ____.

A. Date() B. Date: C. [Date] D. (Date)

Computer Science & Information Technology