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?
jkhippie
0
Newbie Poster
Recommended Answers
Jump to PostIn 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 …
Jump to Postyou have the word const in the wrong place
void Draw() const
See this tutorial
All 8 Replies
vmanes
1,165
Posting Virtuoso
jkhippie
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
jkhippie
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
jkhippie
0
Newbie Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
jkhippie
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.