C++ programming language provides structures (using keyword struct) and classes (using keyword class) to create user-defined data types. Instances of these data types are known as objects.
C++ structures and C++ classes are exactly same except default access specifier of their members. In C++ struct all members are public by default while in class all are private by default.
Example:-
class A{
int i; //private by default
public:
int j;
};
struct B{
int i; //public by default;
private:
int j;
};
C++ structures and C++ classes are exactly same except default access specifier of their members. In C++ struct all members are public by default while in class all are private by default.
Example:-
class A{
int i; //private by default
public:
int j;
};
struct B{
int i; //public by default;
private:
int j;
};
0 comments:
Post a Comment
Hey this is a test comment