A computer virus is a computer program that can replicate itself and spread from one computer to another. The term "virus" is also commonly, but erroneously, used to refer to other types of malware, including but not limited to adware and spyware programs that do not have a reproductive ability.
Malware includes computer viruses, computer worms, Trojan horses, most rootkits, spyware, dishonest adware and other malicious or unwanted software, including true viruses.
Viruses are sometimes confused with worms and Trojan horses, which are
technically different. A worm can exploit security vulnerabilities to spread itself automatically to other computers through networks,
while a Trojan horse is a program that appears harmless but hides
malicious functions. Worms and Trojan horses, like viruses, may harm a
computer system's data or performance. Some viruses and other malware
have symptoms noticeable to the computer user, but many are
surreptitious or simply do nothing to call attention to themselves. Some
viruses do nothing beyond reproducing themselves.
An example of a virus which is not a malware, but is putatively benevolent, is Fred Cohen's compression virus. However, antivirus professionals do not accept the concept of
benevolent viruses, as any desired function can be implemented without
involving a virus (automatic compression, for instance, is available
under the Windows operating system at the choice of the user). Any virus
will by definition make unauthorised changes to a computer, which is
undesirable even if no damage is done or intended. On page one of "Dr
Solomon's Virus Encyclopaedia", the undesirability of viruses, even
those that do nothing but reproduce, is thoroughly explained