nested structures

Nov 20, 2012 at 2:40pm
How do I access struct s3 from main().

Thanks H. Hampton

1
2
3
4
5
6
7
8
9
10
11
12
13
struct s1
{
    int a;  int b;  int c;
    void f1(int*);
    struct s3
    {   double arch;
        int x;
        int y;
        int z;
    };
} ;

struct s1::s3;
Nov 20, 2012 at 2:49pm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
struct s1
{
    int a;  int b;  int c;
    void f1(int*);
    struct s3
    {   double arch;
        int x;
        int y;
        int z;
    };
};

s1 MyOwnStruct;


int main()
{
     MyOwnStruct.s3.x;
}



Nov 20, 2012 at 2:50pm
s1::s3
Nov 20, 2012 at 3:07pm
s3 is a member of s1, but it is not a member variable of s1, hence you cannot access s3 through an instance of s1
Nov 20, 2012 at 3:25pm
Thanks
Topic archived. No new replies allowed.