Be the first to post for 'Constructors For Initialisation'!

If you’re reading this, there probably aren’t very many posts yet. But don’t worry, you can be the first! Either create a new post or just reply to this one to say ‘hi’.

Man this constructor stuff is serious business. I’m still trying to get my head around all these things in the header and class file. So far what I get is that the constructor is important and takes precedent over the methods but other than that I’m kind of lost. I also don’t know why we declared a variable with another variable for MyMaxTries we set it equal to MAX_TRIES where MAX_TRIES = 8. Why not just have one variable?

I guess the problem I have with the constructor is how would I use this in a program or game program to be specific because I doubt it will always be used to just reset the game by the constructor. Having a hard time looking at the bigger picture.

Have good day everyone.

Hi there, a coupe of suggestions. Firstly move on because sometimes things more clearly seen “from above”, that is once you have more context around it.

Secondly, I’m sure @DanM will have a thing or two to say about constructors.

There is no point, creating a constexpr variable with the sole purpose to initialise another variable is redundant.

Privacy & Terms