No, just left it at that. Which made me laugh because even after everyone pointed out reasons you didn't have to learn C first he didn't change his view. Blind dedication must be nice. Nah!
Well I'm glad you used the tags, but sarcasm is just lost on some people ;).
Though, chrisname, if you want to be anal, you are wrong. As structs are public by default and classes are private by default. So depending on the programmer's preference one is better than the other (per need though).
@Fredbill30
I noticed the sarcasm tags and I did realise that sarcasm tags indicate sarcasm (I can read, as you are surely aware given that we are communicating via text). You were still wrong; neither is better than the other because they're exactly the same thing. Just trying to encourage precision. Even in jokes.
BHXSpecter wrote:
sarcasm is just lost on some people
Yeah, I don't understand sarcasm. Good one. We're all laughing over here at your funny joke. Because you're funny. You're a funny guy. A funny guy who understands sarcasm, unlike me.
Though, chrisname, if you want to be anal, you are wrong. As structs are public by default and classes are private by default. So depending on the programmer's preference one is better than the other (per need though).
This is like saying a car with the steering wheel on the left and a car with the steering wheel on the right are not both cars. They're exactly the same thing, they just aren't identical.
Also, it's not like you can't explicitly change the access in either case, so how is one ever better than the other? Because it saves you from typing at most ten extra characters?
I guess no matter how hard I try to please you guys, I never can.
Have you tried going away? [/sarcasm]
Also, it's not like you can't explicitly change the access in either case, so how is one ever better than the other? Because it saves you from typing at most ten extra characters?
Well I guess they can be used to clarify intent, using struct's as POD?
Well I guess they can be used to clarify intent, using struct's as POD?
Well, that's what I use them for. I also like to #define interface struct so I can pretend C++ has interfaces. It doesn't make them different to or better than classes.
Yeah, I don't understand sarcasm. Good one. We're all laughing over here at your funny joke. Because you're funny. You're a funny guy. A funny guy who understands sarcasm, unlike me.
Split personalities and word repetition, are you seeing a psychiatrist? With help you can get your life back. Just have to admit you have a problem.
chrisname wrote:
This is like saying a car with the steering wheel on the left and a car with the steering wheel on the right are not both cars. They're exactly the same thing, they just aren't identical.
That has got to be the dumbest comparison I've seen in a long time for equating structs to classes. Yet even your argument still has drivers saying one way is better than the other. Just like some drivers, some programmers will consider one better than the other.
They have even done 'blind taste studies' where they had the exact same thing in both cups, claimed they were different, and people would say one was better than the other. Actually, I remember them doing this for when Starbucks started offering just regular coffee, a study was done where they just used cheap coffee and said one was $x for it while the other was Starbucks for $7 a cup, everyone picked Starbucks thinking it was better.
Point is, tons of things are the exact same with only minor variants, but you will always have people that say one is better than the other.
Split personalities and word repetition, are you seeing a psychiatrist? With help you can get your life back. Just have to admit you have a problem.
I really hope you were trying to be funny with this, and you aren't as stupid as someone would have to be to miss the sarcasm in my last post. I didn't think I would have to be explicit about it, seeing as sarcasm was the topic of discussion.
That has got to be the dumbest comparison I've seen in a long time for equating structs to classes.
I see you completely missed my point. A class and a struct are the exact same thing as each other with one minor, very superficial difference. A car with the steering wheel on the left and one with the steering wheel on the right are also the exact same thing as each other with one minor, very superficial difference. So the analogy is valid. What makes it "dumb"? That you don't understand it? That some people prefer one over the other for absolutely no reason whatsoever, except that it's their "personal preference"? That people are stupid and settle on preferences without doing any reasoning first? I know all these things, I don't need to be told them.
Point is, tons of things are the exact same with only minor variants, but you will always have people that say one is better than the other.
And if it really is a minor variation, they will always be wrong. So what exactly is your point?
I really hope you were trying to be funny with this
Yes. I was poking fun at the 'we' part of your comment.
I see you completely missed my point.
No I got your point, and people can have valid analogies, but they can still be dumb. The public/private by default and changing them is superficial, a car with steering wheel on one side or the other and changing them is not (which is where I said the analogy was dumb due to the drastic levels of change compared to changing public/private and changing left/right steering column).
And if it really is a minor variation, they will always be wrong. So what exactly is your point?
You missed my point though. Let me rephrase it. Anyone that has learned classes from a C++ tutorial or book knows that classes and structs are the same thing. If a person says one is better, it is their personal opinion and they won't change no matter how many times you point out the fact. :P
I want to make one thing clear, I was saying the complexity of the car analogy I thought was dumb. I was not and do not think you are dumb.
Well, technically if we're speaking C v C++ then C structs wouldn't be exactly the same to C++ classes/structs.
That's very true, C++ structs are totally different to C structs.
(I don't even know why people still use C, except for systems without C++ compilers.)
C++ has namespace, classes and overloading, which means that multiple symbols can have the exact same name provided (1) they aren't in the same namespace or (2) they don't have the same number and types of parameters. To achieve that, C++ does something called "name mangling", which means that a function called foo won't necessarily be referred to by a symbol named foo: if it's in namespace std and takes two int parameters then it might be called std_foo2int. The problem with name mangling is that there's no standardised way to do it, so two different compilers, or even different versions of the same compiler (maybe even the same version of the same compiler with different settings) won't produce the same symbol names, which means that you may not be able to use symbols in a file compiled by different C++ compiler or compiler version. You can use external linkage (extern"C") but you have to wrap everything.
Not totally different. Just C++ structs have... well more.
Well, so much more that they are totally different. Write a C program using a struct and you will see.
Just going back to Starbucks coffee mentioned by BHX, I refer to it as Tarbucks because they just don't seem to know how to do it - IMO compared to other coffee makers anyway ..... :-)
Edit:
I wonder how many people were aware the C++ unions are also similar to C++ classes, they can have ctor, dtor, functions & access specifiers, but there are a list of restrictions.