Exercises in this lecture  previous -- Keyboard shortcut: 'p'  next -- Keyboard shortcut: 'n'  Go to the slide, where this exercise belongs -- Keyboard shortcut: 'u'  

Exercise 1.3
Specialization of persons with a union type


2014 and 2015: I do not recommend that you spend time on this exercise...

Introduce two variants of persons, as introduced in the C program on the accompanying slide.

Introduce two different person types, and a union that allows us to represent either a 'person with a home address' or a 'homeless person'.

You can read about unions in The C++ Prog. Lang. (3. edition) section C.8.2.


There is no solution to this exercise