Nov 29, 2012 at 5:25am UTC
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 :)
Nov 29, 2012 at 5:34am UTC
the only other difference is that default inheritance is public for structs and private for classes.
Nov 29, 2012 at 5:43am UTC
Last edited on
Dec 9, 2012 at 7:50pm UTC
Nov 29, 2012 at 5:46am UTC
Umar Aftab, you're wrong in everything you say there.
Nov 29, 2012 at 5:58am UTC
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