I'm reading my C++ book and I've come to a chapter on structures and unions. The book has tried to explain the difference but I'm not getting it's explanation. Playing with the structure examples in the book reminds me of accessing attributes to a python Class but apart from that, probobly inacurate observation, I don't really get them.
lewashby
56
Junior Poster
Recommended Answers
Jump to PostPlaying with the structure examples in the book reminds me of accessing attributes to a python Class
That's not a bad analogy. A structure in C++ is just a class with different default access (public instead of private). A union is different in that all members of a …
Jump to PostYou can make out the different of structure and union by going through the following points.
Structure :
1.The keyword struct is used to define a structure
2. When a variable is associated with a structure, the compiler allocates the memory for each member. The size of structure is greater …
All 7 Replies
deceptikon
1,790
Code Sniper
Team Colleague
Featured Poster
lewashby
56
Junior Poster
Moschops
683
Practically a Master Poster
Featured Poster
sepp2k
378
Practically a Master Poster
rubberman
1,355
Nearly a Posting Virtuoso
Featured Poster
dinad578
9
Newbie Poster
cheryllocascio
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.