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 virtual void f();. Suppose class D has its version of the function, void f(). Here is a pointer definition and an access to a member function..
```
B* bPtr = new D;
BPtr->f();
```

a) D::f()
b) B::f()
c) This is illegal. You can’t assign a D object to a variable of type pointer to B.


a) D::f()

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

Computer Science & Information Technology

You might also like to view...

When choosing custom colors, try to choose colors with high ________

Fill in the blank(s) with correct word

Computer Science & Information Technology

With onion skinning, the ____ option sets the onion skin markers to display two frames before and after the current frame.

A. Always Show Markers B. Anchor Onion C. Marker Range 2 D. Onion 2

Computer Science & Information Technology

A memory-resident array contains information that may not have been saved to a hard disk or other storage

Indicate whether the statement is true or false

Computer Science & Information Technology

In computer memory, the memory addresses are in binary.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology