Difference between class and structure:
In this tutorial we are going to see what is difference between class and structure in cpp.
What is class ?
Class definition : Class is a user defined data type. It encloses data members and member functions.
By default all the members of the class are private.
Generally all the data members are private and member functions are public. But , sometimes data members can be public and member functions can be private.
What is structure in cpp
- Structure is user defined data type
- Structure is collection of elements of different type
- It is used to store values of different type of variable
- Now lets see what are the differences in class and structure in cpp
Difference between class and structure
Also Read –
- Arrays in Cpp
- Strings in cpp
- Structure and Union
- Operator overloading
- Inline function
- Friend Function