Sunday, November 21, 2010

Anonymous Unions

Members of an anonymous union look like members of the enclosing class.

Without using anonymous unions in classes, you need to use the union name when referencing a union member. For example: myObject.myUnion.myMember instead of myObject.myMember.

Reference: C++ Templates by David Vandevoorde and Nicolai M. Josuttis. Addison-Wesley, 2003, p. 143.

No comments:

Post a Comment