Advanced C++
Q72 / 100

What is the One Definition Rule (ODR)?

Correct! Well done.

Incorrect.

The correct answer is B) A program can have only one definition of each variable/function, but inline functions and templates may be defined in multiple translation units if all definitions are identical

B

Correct Answer

A program can have only one definition of each variable/function, but inline functions and templates may be defined in multiple translation units if all definitions are identical

Explanation

ODR violations (multiple different definitions of the same entity) cause undefined behavior. Inline, constexpr, and template definitions in headers are ODR-exempt if identical.

Progress
72/100