Suppose this is embedded in an otherwise correct and complete program. Which version of f() will be called?

Suppose class D is derived from class B, and class B has a public member function whose declaration is void f();. Suppose class D has its version of the function, void f(). Here is a function definition and an invocation.
```
void g( B& b)
{
// other code
b.f();
// other code
};

g( dObject );
```

a) D::f()
b) B::f()
c) This is illegal. You can’t pass a D object argument for a B reference parameter.


b) B::f()

When the functions are not virtual, and access is made through a pointer or a reference (here a reference) the function called follows the type of the pointer or reference.

Computer Science & Information Technology

You might also like to view...

What is Strong element?

What will be an ideal response?

Computer Science & Information Technology

Which of the following is the correct syntax to create a static route?

a. ip route b. route c. ip route d. ip route

Computer Science & Information Technology

In recent systems, what feature can detect and display internal case temperatures?

a. Task Manager b. System Monitor c. Hardware Monitor d. CPU Status

Computer Science & Information Technology

Individuals who maintain connections with other people in order to share information or participate in activities of common interest are involved in a process called _________________________.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology