Wednesday, January 5, 2005 12:41 AM
In C struct is a construct that contains different variables, possibly of different types - like a compound variable.
In C++ it is the same but it can also have functions that operate on these variables. All variables and all methods are public. Thus in C++ struct is like a class where everything in public by default, unless you say otherwise.
In C++ class contains variables and method but everything is by default private and you can say otherwise.
In Java there is no struct.
In Java a class contains variables and methods that operate on the variables. By default everything has default access - meaning public for other classes in the same package and private elsewhere and - of course - you can say otherwise.
To say otherwise - in C++ and Java - use the keywords private, protected or public.