Difficulty: Easy
Correct Answer: Friend constructor
Explanation:
Introduction / Context:
Constructors initialize objects and establish class invariants. C++ recognizes several common constructor categories by usage rather than special keywords. This question checks whether you can distinguish real constructor types from invalid notions in standard C++ terminology.
Given Data / Assumptions:
Concept / Approach:
Recognized categories include: default constructor (no parameters), parameterized constructor (with parameters), and copy constructor (takes const Class& under typical form). There is no such thing as a “friend constructor.” The friend
keyword grants another function or class access to private/protected members; it does not turn a constructor into a different “type.” Constructors themselves can be friends of another class, but that does not create a new constructor category.
Step-by-Step Solution:
Verification / Alternative check:
Reviewing language references shows friend applies to functions/classes for access control. A constructor may be declared friend of another class, but its own classification remains default/parameterized/copy/move.
Why Other Options Are Wrong:
Copy constructor: initializes from another object of the same type.
Default constructor: callable with no arguments.
Parameterized constructor: accepts arguments to customize initialization.
Common Pitfalls:
Final Answer:
Friend constructor
Discussion & Comments