Which of the statements are CORRECT?
(A) Constructors are invoked automatically when objects are created.
(B) Constructors do not have return types, not even void, and therefore cannot return values.
(C) Constructors cannot be inherited, though a derived class can call the base class constructors.
(D) Constructors can be declared as virtual.
Choose the correct answer from the options given below:
Pick an option to check yourself, or open the answer below.
Show answer & explanation
Correct answer: B. (A), (B) and (C) Only
Explanation
A, B and C are standard facts. Constructors cannot be virtual (destructors can).More Programming Languages and Computer Graphics questions
- Match List I with List IIList I List II (a) Bresenham (I) Hidden surface removal (b) Cohen-Sutherland algorithm (II) Line drawing (c) Suthe…
- Consider the following code segment:int arr[] = {0,1,2,3,4}; int i = 1, *ptr; ptr = arr + 2; Arrange the following printf statements in inc…
- Statement (I): A friend function and the member functions of a friend class can directly access private and protected data. Statement (II):…
- Match List I with List IIList I List II A. Bezier curves I. 3-D objects that have translational/rotational symmetry B. B-Splines II. Fracta…
- What will be the output of the following code?#include <stdio.h> int main() { int a, b, c; a = 0x10; b = 010; c = a + b; printf("%d", c); r…
- A three-dimensional array in C++ is declared as int A[a][b][c]. Array elements are stored in row-major order and indexing begins from 0. Th…