Is there a difference between a class and a struct? At first I thought a struct could not have methods/constructors/destructors, but now I found out they can, so what is the difference?

The Complete Reference C++ (4 ed) goes into pretty good detail about the relationship between a class and a struct. Basically, the struct is part of the C subset of C++ and was kept in the language (with some enhancements) so that C++ would always be compatible with C. The book also warns that, although you can do a lot with struct, it should be reserved for when you need to create a C-style structure [no data members, no constructors/destructors].

So, in C++ they made a WHOLE other, um, (I want to say structure, but that would be confusing), thing that's the exact same as a struct, which they could have kept, but they made a whole new one, just to make the default access level private?

Yep. It might have been the case that the guy who designed C++ at first thought that only classes would have member functions, but then gave structs the ability too for some reason or another.

This article has been dead for over six months. Start a new discussion instead.