Class Vs. Structure

closed account (z0XLy60M)
What are the differences between a class and a structure ?

(Besides the fact that the default access specifier of a class is private and that of a structure is public..)
Are there any other differences in these two ?

(eg. Do constructors and inheritance works identically in both these ?)
Pls list all the point that you know of.

thank you :)
the only other difference is that default inheritance is public for structs and private for classes.
closed account (DETpfSEw)
...
Last edited on
on a broader level classes support all facilities provided by OOP (inheritence etc.) while structures do not.
This is false. structs have the same capabilities as classes.
Umar Aftab, you're wrong in everything you say there.
Structs are preferred when you just need a data structure, without methods. The preference comes from the fact that structs in C could only store data, but they aren't more suited or anything like that
There was a whole discussion on this same topic in another forum post here:

http://www.cplusplus.com/forum/lounge/86137/
Topic archived. No new replies allowed.