My understanding of a struct was that everything was public. The definition of a struct that I got was it was a class with everything public but retained the size of only the data within. I have never used private in a struct but if private is allowed in a struct, john's suggestion above will do it.
In C++ a struct is essentially the same thing as a class. You can created methods for the struct, both public and private as well as public and private data. The usage allows for encapsulation in a struct. However, the main uses in C++ for a struct are for compatability with C programs and creating structures with publicly accessable data.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.