I am strongly influenced by someone who writes his C++ with a lot of C elements |
I used to be a C/C++ mishmash coder. Partly the reason I clung to C concepts was because I didn't fully understand C++ and OOP constructs. I can't say that the C++ way is "better" all around, but I find that once you get it, it really does make most things a lot easier. It takes a completely different mindset though -- one your mentor might not fully have.
Herefore I avoided to use the string lib. |
Don't avoid it. It's better. Less error prone, easier syntax, and will have better performance most of the time.
There are instances where you're better off not using std::string, but for simple string tasks like what you're doing, there's really no reason not to use it.
I tried to construct my own "versions" of "strlen()" etc. because of that I used this loops. |
Why? Are you doing this just for educational purposes / to see if you can do it?
As for your code snippit, you have a few problems:
1) Don't explicitly call dtors like that. The only time you should explicitly call a dtor is if you're overloading your own delete operator.
2) Always make sure to delete whatever you make with new
3) Is the m_constructGame a static function? If not, there's no need to create a new setPlay instance in the function like that. You can just use 'this'.
I get the impression you don't fully grasp the concept of classes yet. Can you post your entire setPlay class? Maybe I can point out what you should and shouldn't be doing.