As others have said, it can be done, but you must have a proper transfer switch setup to be legal (and keep the linemen safe, and make sure you don't try to power the neighborhood with your little generator). Mortimer Brewster's link is nice and clear, and the described setup looks to me to be done properly to code.
Incidentally, the connector for the house would be an inlet, not an outlet, and would be male, rather than female. The side of the connector that supplies mains power is invariably female so you don't have exposed live prongs when things are unplugged. Any setup that can permit a live male plug is dangerous and should not be used (and usually contrary to code and so illegal).