Which of the following can be virtual?

a. Constructors
b. Destructors
c. Ordinary functions
d. Friend functions
e. Static functions


Parts b) c)
Explanation: Part a) is wrong. The virtual keyword may not be applied to any constructor. Part d) is wrong. Functions that are friends cannot be virtual, since they are not class members. Part e) is wrong. The fact that virtual functions are called through an object contradicts the function’s static nature. (A static function is associated with the class, not any object).

Computer Science & Information Technology

You might also like to view...

Which of the following methods would you use to search a character for a specific string?

a) substring b) charAt c) substr d) indexOf

Computer Science & Information Technology

In shallow copying, each reference variable refers to its own object.

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

Computer Science & Information Technology

In a networked environment, each computer on the network can access the hardware on the network.

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

Computer Science & Information Technology

Compiling is the process of writing instructions in a language that the computer can respond to and that other programmers can understand.

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

Computer Science & Information Technology