[examples] change construction order to avoid gcc/clang warning