1234567891011
struct Weapon { Weapon( int dmg ) : damage( dmg ) {} int damage; }; Weapon sword( 25 ); Weapon spear( 20 ); Weapon arrow( 15 ); Weapon dagger( 10 ); Weapon knife( 5 );
1234567
struct Character { Weapon weapon; }; Character myChara; myChara.weapon = sword;