Quote:
|
Originally Posted by grafman
A structure is just data. It can hold a pointer to a function but you don't define behavior in them.
A class defines data and King Coder said and in it you define "functions" or methods that encapsulate the behavior of the resulting objects.
I suppose that you could define a data only class, but I don't know how practical that would be unless it was embedded in another class. But then you'd probably use a structure.
The way to really tell the difference is that you can define a class to do something to something else. A structure can only have things done to it.
|
not true... a structure and class function exactly the same except for the default access. structure being public by default, and class being private by default.