3.11 STRUCTURES
Business data processing was the prime computing activity for last 30 years. Data were typically in the form of records. A record consists of one or more variables (representing data items). Records are called structures in C++. A structure is essentially a collection of variables to represent specific data (or an entity).
Let us take a familiar example of date. It has three components viz. day, month and year. In a C++ program, we can define a structure “Date” as shown below.
struct Date { int day int month; int year; } ;
The definition starts with keyword struct. The word Date appearing after keyword struct is known as “structure tag”.
Now this tag “Date” represents a type. We can define variables of this type ...
Get Object Oriented Programming with C++, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.