
258 Classes and Objects
8.1 INTRODUCTION
In C, structures are used to define custom or user-de-
fined data type. Structure is a combination of same
or different data types. Only variables are declared
inside a structure. The initialization of member vari-
ables inside the structure is not permitted. Objects can
directly access the data members of the structures.
Functions are not permitted as members in struc-
ture. Outside functions are also able to access the data
members of the structure through the object. Thus,
there is no security to data members declared inside
the structure in C as shown in Figure 8.1.
In C++, structu ...