Which of the following statements is TRUE?
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: C. We can never build an object from a class containing a pure virtual function
Explanation
A class with a pure virtual function is abstract and cannot be instantiated. Virtual functions are exactly how run-time polymorphism through base pointers works, and a pure virtual function may still be given a body.More Programming Languages and Computer Graphics questions
- What is the output of the following program?#include<stdio.h> int main() { int i = 3; while (i--) { int i = 10; i--; printf("%d", i); } pri…
- The hue of a colour is related to its:
- What is the output of the following program?#include <stdio.h> #define SQR(x) (x*x) int main() { int a, b = 3; a = SQR(b+2); printf("%d", a…
- Consider the three points P1(1, 2, 0), P2(3, 6, 20) and P3(2, 4, 6) and a viewpoint C(0, 0, −10). Choose the correct options. (A) P1 obscur…
- Which of the statements are CORRECT? (A) Constructors are invoked automatically when objects are created. (B) Constructors do not have retu…
- Match List I with List IIList I List II (a) Bresenham (I) Hidden surface removal (b) Cohen-Sutherland algorithm (II) Line drawing (c) Suthe…