Heroin is the compound diacetyl morphine which, contrary to the node this will lead you to, is a morphine group with two acetyl groups attached. Morphine is the same in structure except the acetyl groups are replaced with hydrogens making the characteristic hydroxyl or OH group. As I lamely tried to show, there is a bridge connecting A and B which consists of two carbons. A is an ordinary carbon, while B is a nitrogen.

           O==C--O
              |   \______
                  //    \\
               __//      \\
              /  \        /
             O    \======/            ______
            /     /      \           /      \
           /____A/        \         /        \
          /      \        /        A          B
O==C--O__/        \______/
   |     \        /      \
          \======/        \
                           B--

As usual with the skeleton structure diagram, the lines have carbons at vertices unless otherwise noted, and the remaining valences must be filled with hydrogen.

The two hydroxyl groups in morphine, and the two acetyl groups in heroin would seem to suggest that a reaction can readily occur with morphine to yield heroin. In fact all one needs to do is add some acetic anhydride(ethanoic anhydride). The OH groups of the morphine combine with the anhydride to yield ethanoic acid and an ester. If this is done with both of morphine's hydroxyl groups, we get heroin.

Both morphine and heroin are said to be good analgesics, but heroin, however, is stronger, and has less of an effect on the respiratory system (which is good). The telltale nausea of morphine is still present though, and heroin is more addictive.