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;
};
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