Welcome to graduate2professional.blogspot.com

Wednesday, November 11, 2009

What's the difference between the keywords struct and class?

Class is defined as-
1. Class is a successor of Structure. By default all the members inside the class are private.
2. Class is the advanced and the secured form of structure.
3. Classes are reference typed.
4. Class can be inherited.
5. In Class we can initilase the variable during the declaration.
6. Class can not be declared without a tag at the first time.
7. Class support polymorphism.

Structure defined as :
1. In C++ extended the structure to contain functions also. All declarations inside a structure are by default public.
2. Structures contains only data while class bind both data and member functions.
3. Structure dosen't support the polymorphism, inheritance and initilization.
4. Structure is a collection of the different data type.
5. Structure is ovrloaded.
6. Structures are value type.
7. Structure can be declared without a tag at the first time

No comments:

Post a Comment