fix issue #3347 modify chapter 6.

add sample code.