Quote Originally Posted by Elysia View Post
The problem is that there is a different way of doing C++ than C.
You seem like a typical example of someone who has a C background. By C++ purists, this is the "wrong" way. If you're going to learn a language, then you should do it after the standard practices adopted by that language.
The idea is to teach newbies the purist way, and then they may derive a way that works from them from that.
If the OP is not someone with a C background, then you are needlessly complicating things by including things that really aren't the "C++ way". Therefore it is bad.
Yes I do have C background... Anyway I still dont believe that mixing C and C++ makes the code "bad", but I have to agreed that it can make the code a little more confusing for those who arent very familiar with the C programming language and is different from "pure" C++ code. But I like programming the "C way", and as long as it works for me I'll keep doing it... As I said before, I can't teach someone to code diferently than I do... Now if you believe that I shouldnt try to help C++ programmers just because Im more of a C programmer than a C++ programmer, I cant help you... I'll still try to help the way I can and am comfortable with.


Quote Originally Posted by Elysia View Post
What if they don't know arrays and how they are contiguous in memory? What if they don't understand the concept of writing and reading raw?
We're arguing semantics here. If you are a C++ programmer, then it is better to learn operator overloading than reading and writing raw.
And if you're a programmer, you should learn what is an array and how it works. I believe one of the first things one do when starting to learn any programming language is counting to n using a for loop and an int array, not overloading an operator.


Quote Originally Posted by Elysia View Post
While I vehemently disagree with that, it doesn't change the facts. You should write operator for your string class as you would for any other. Then you can use << and >> outside the class, as with everything else.
Now, when you implement those operators, you can go ahead and do read/write raw because the class knows how it's implemented and therefore knows how to serialize itself.

Most programmers I know do disagree with that, but I still believe someone who is still learning should first learn how a function works, not what it does. I cant really say what kind of code I should show him since I have no ideia of his current level, so just be happy with the C mix code and keep reading your book, because Im not your teacher here, just a member trying to help using my everyday style. I wont change my style just because someone thinks it is wrong to use C style, even though I understand his point