=====struct=====
Syntax:
struct struct-name : inheritance-list {
public-members-list;
protected:
protected-members-list;
private:
private-members-list;
} object-list;
Structs are like `classes`, except that by default members of a struct are
public rather than private. In C, structs can only contain data and are not
permitted to have inheritance lists.
The object list is optional -- structs may be defined without actually instantiating any new objects.
For example, the following code creates a new datatype called **Date** (which contains three integers) and also creates an instance of **Date** called **today**:
struct Date {
int day;
int month;
int year;
} today;
int main() {
today.day = 4;
today.month = 7;
today.year = 1776;
}
Related Topics: [[class]], [[union]]