Friday, 18 May 2012

0 Different Between Structure and Class

   A structure is a user defined data type in C++,and it can contain different types of data items.A class is also user defined data type that groups together data as well as functions.Structures do not support data hiding,because all the data members of a structure are public by default,and the members of a class are private by default.

Class Declaration 

Generally a class have two points
1. Class declaration
2. Class function definitions

Class Class_name
{
Private:
variable declarations;
public:
Function declarations;
};


Structure Declaration

struct structure_name
{
int a;
char b;
float c;
};



0 comments:

Post a Comment

 

Coding Authority Copyright © 2011 - |- Template created by O Pregador - |- Powered by Blogger Templates