Struct

Struct
A struct is a class without restrictions. A struct is a useful tool to group data and methods for that data. In a struct you can declare objects, methods, a constructor and destructor. But unlike a class none of the values are private or protected, all are public including the methods. None of the data can be static.

In C++
code format="cpp"
 * 1) include

struct student{ int id; //data char *name; student(char *name, int id); //constructor ~student; //destructor void print; //method };//don't forget this semicolon

student::student(char *name, int id){ this->name = name; this->id = id; } student::~student{ delete[] name; } void student::print{ printf("%d: %s\n", id, name); }

int main{ student tyler("Tyler Brazill", 55555); //initialization with constructor tyler.print; //call to the method

return 0; }

code