15,794,593 members
See more:
1. I read many tutorials i understand the method of nested structures but i can not understand
why we use nested structures?
Posted

## Solution 2

The following C style:
C++
```typedef struct {
int x, y;
} point, * ppoint;

typedef struct {
point; // a "derivation" :)
int r;
} circle, * pcircle;

typedef struct {
point c; // an aggregation :)
int r;
} circleEx, * pcircleEx;```

...would be "equal" to the C++ style :) :
C++
```class CPoint
{
int x, y;

public:
//...
};

class CCircle : public CPoint
{
int r;

public:
//...
};

class CCircleEx
{
CPoint c;
int r;

public:
//...
};```

v2
Leo Chapiro 7-Mar-13 9:10am
Good point, actually shoud the question means "Why we use nested structures in C" :)
Eugen Podsypalnikov 7-Mar-13 9:21am
Very likely... :)
Thank you !

## Solution 1

Because the member of a structure can be more complex as a simlple variable, for example like struct date:

C#
```struct Employee
{
char ename[20];
int ssn;
float salary;
struct date
{
int date;
int month;
int year;
}doj;
}emp;```

v3