LearnFrenzy
Sign in Take a free test

Polymorphism and Virtual Functions · Polymorphism MCQ · Question 18

What is CRTP? Answer, explanation & discussion

  • MCQ
  • Hard
  • 0 comments
  • Answer explained
  • Moderated community
Question 18 Back to Exercise

What is the Curiously Recurring Template Pattern (CRTP)?

  • A A recursive template function
  • B A class deriving from a base template instantiated with itself (class D : Base<D>), letting the base call derived functions at compile time Correct
  • C Virtual inheritance with templates
  • D A pattern for recursion
Correct Answer: Option B

It gives static polymorphism without vtables, at the cost of a fixed set of types per base instantiation.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links