struct vs class

I am writing a sudoku-type game, and I want to have a random generator call a game from a list of saved games. Should I use a struct, a class, or something else?
struct and class is the same thing. Only difference is that with class the default is private and with struct the default is public.
The only difference between a struct and a class, is the default access level. A struct's default access level is public, while the latter's is private.

In that case, I will use a struct.

Thanks for responding!
I thought that struct couldn't have member functions?
georgep wrote:
I thought that struct couldn't have member functions?

Try it and see.

Really -- the only two differences are default member access and inheritance type (public/private).
Huh, I never knew that!

I thought structs were a C thing and classes were a C++ thing. Are there really other differences between them?

I'm guessing you can't use inheritance with structs, but I'm probably wrong there too.
I'm guessing you can't use inheritance with structs, but I'm probably wrong there too


You can.

As PanGalactic said... the only difference is the default access.


That said... structs and classes are conceptually different, even if the language doesn't treat them very different.
Topic archived. No new replies allowed.