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.
You might also like to view...
How does a router determine whether datagram to a particular host can be directly delivered through one of its interfaces?
What will be an ideal response?
When a program is executing, and it reaches a declaration of an object variable, where does the program execution automatically go to next?
A. The class destructor. B. The class constructor. C. The class instructor. D. The class scope operator.
How can you be sure that data loaded with a URLRequest instance is available in Flash?
What will be an ideal response?
?What statement is required in the function getSquarePerimeter to assign a value to the variable p in the following statement? ? p = getSquarePerimeter(side);
A. ?release B. ?return C. ?assign D. ?set