Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

the use of “union” in all derived classes #1

Open
wangbw1116 opened this issue Mar 17, 2021 · 1 comment
Open

the use of “union” in all derived classes #1

wangbw1116 opened this issue Mar 17, 2021 · 1 comment

Comments

@wangbw1116
Copy link

It's extremely awsome to realize all design pattern by C,but I'm wondering why there is a union type in each derived class,such as

struct _FindPwdMessage
{
	union
	{
		AbstractMessage;
		AbstractMessage abstractMessage;
	};
};

why it not been expressed like

struct _FindPwdMessage
{
	AbstractMessage abstractMessage;
};
@stringtrim
Copy link

I have the same question here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants