You can usually train thru a cold, but I don't suggest training thru a flu.
Regardless of what you have, training will hamper your body's ability to recover from it as fast as it could have if you had rested and not trained.
When I was younger I'd train through any illness. Now that i'm older I stay home and rest. A few days off won't affect anything in the gym and will allow you to kick the bug faster.
Honestly, bed rest is best for any illness. It will shave time off of your recovery rate.