Initialization List Practice
Task
Swipe to start coding
You are working with a class that requires proper initialization of its member variables.
- Rewrite the constructor using an initialization list instead of assigning values inside the constructor body.
- Make sure the initialization order follows the order in which the member variables are declared in the class.
Solution
solution.cpp
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Awesome!
Completion rate improved to 3.13Awesome!
Completion rate improved to 3.13
Initialization List Practice
Task
Swipe to start coding
You are working with a class that requires proper initialization of its member variables.
- Rewrite the constructor using an initialization list instead of assigning values inside the constructor body.
- Make sure the initialization order follows the order in which the member variables are declared in the class.
Solution
solution.cpp
Everything was clear?
Thanks for your feedback!
SectionΒ 2. ChapterΒ 4
single
Awesome!
Completion rate improved to 3.13
Initialization List Practice
Swipe to show menu
Task
Swipe to start coding
You are working with a class that requires proper initialization of its member variables.
- Rewrite the constructor using an initialization list instead of assigning values inside the constructor body.
- Make sure the initialization order follows the order in which the member variables are declared in the class.
Solution
solution.cpp
Everything was clear?
Thanks for your feedback!