I solved the exercise by creating some private data in the class, adding a class constructor function and returning an instance of the class by calling the constructor with new in the static member function that returns a class instance. But I stumbled into this solution. I said let me create a constructor since I’m stuck and see if calling the constructor in the static member function that returns an instance solves my problems, and that solved my problems. But I didn’t do it ‘organically’ by reading the instructions part of the exercise. The instructions talk about classes with public and private designations without saying anything about static or the apparently common pattern as I found by internet searches of returning an instance with the constructor in a static member function.
I propose that the exercise’s instructions part should be updated to include a section about static functions and somehow make it clear you are supposed to return with new and a constructor you make yourself in that static function as well. Or split the exercise in 2? Knowing how to use static in the exercise and solving the puzzle of the 6 tasks that are required are in my opinion things that can be made 2 exercises instead of 1.
Thanks for reading.