union inside struct
// union inside struct.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
struct TestStruct
{
public:
int a;
int b;
union ZZZ // Note here!!
{
public:
int d;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
TestStruct instance;
instance.a = 100;
instance.b = 200;
instance.ZZZ::d = 300;
//instance.ZZZ::c = {'G','c','A'};
/*TestStruct::ZZZ uni;
uni.d = 300;*/
printf("%d\n", instance.a);
printf("%d\n", instance.b);
return 0;
}
//
#include "stdafx.h"
#include <iostream>
struct TestStruct
{
public:
int a;
int b;
union ZZZ // Note here!!
{
public:
int d;
};
};
int _tmain(int argc, _TCHAR* argv[])
{
TestStruct instance;
instance.a = 100;
instance.b = 200;
instance.ZZZ::d = 300;
//instance.ZZZ::c = {'G','c','A'};
/*TestStruct::ZZZ uni;
uni.d = 300;*/
printf("%d\n", instance.a);
printf("%d\n", instance.b);
return 0;
}
Comments
Post a Comment