it is more complicated…

http://www.howstuffworks.com/virus.htm
http://en.wikipedia.org/wiki/Computer_virus
http://www.securelist.com/en/
http://blog.sucuri.net/
https://blog.avast.com/