I wrote a game using an array of structs to represent a 9x9 grid. Now I'm re-writing it as a class to '++ it up' a bit and to better understand classes. Part of the game used a seperate struct to keep track of selected board squares (to see if they match). Would it be proper ettiquete to include a struct as a class member, or is there a more 'proper' way?
Jump to Post
In C++ today, the only significant difference between a struct and a class is the default access - struct, all members are public, class, they're private.
So you could rename your struct as a class, and then include it as a data member of a larger class. Or leave it …
All 8 Replies
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.