Cestoda is a class of parasitic worms in the flatworm phylum (Platyhelminthes). Most of the species—and the best-known—are those in the subclass Eucestoda; they are ribbon-like worms as adults, known as tapeworms. Their bodies consist of many similar units known as proglottids—essentially packages of eggs which are regularly shed into the environment to infect other organisms. Species of the other subclass, Cestodaria, are mainly fish infecting parasites. All cestodes are parasitic; many have complex life histories, including a stage in a definitive (main) host in which the adults grow and reproduce, often for years, and one or two intermediate stages in which the larvae develop in other hosts. Typically the adults live in the digestive tracts of vertebrates, while the larvae often live in the bodies of other animals, either vertebrates or invertebrates. For example, Diphyllobothrium has at least two intermediate hosts, a crustacean and then one or more freshwater fish; its definitive host is a mammal. Some cestodes are host-specific, while others are parasites of a wide variety of hosts. Some six thousand species have been described; probably all vertebrates can host at least one species. The adult tapeworm has a scolex (head), a short neck, and a strobila (segmented body) formed of proglottids. Tapeworms anchor themselves to the inside of the intestine of their host using their scolex, which typically has hooks, suckers, or both. They have no mouth, but absorb nutrients directly from the hosts gut.
Host immunity
Hosts can become immune to infection by a cestode if the lining, the mucosa, of the gut is damaged. This exposes the hosts immune system to cestode antigens, enabling the host to mount an antibody defence. Host antibodies can kill or limit cestode infection by damaging their digestive enzymes, which reduces their ability to feed and therefore to grow and to reproduce; by binding to their bodies; and by neutralising toxins that they produce. When cestodes feed passively in the gut, they do not provoke an antibody reaction. Evolution and phylogeny
Fossil history
Parasite fossils are rare, but recognizable clusters of cestode eggs, some with an operculum (lid) indicating that they had not erupted, one with a developing larva, have been discovered in fossil shark coprolites dating to the Permian, some 270 million years ago.The fossil Rugosusivitta, which was found in China at base of the Cambrian deposits in Yunnan  just above the Ediacaran-Cambrian border, has great similarities to present day Cestodians. If correct, this would be the earliest example of a Platyzoan and also one of the earliest bilaterian body-fossils and might thus provide an insight to the living mode of Cestodians before they became specialized parasites. External
The position of the Cestoda within the Platyhelminthes and other Spiralian phyla based on genomic analysis is shown in the phylogenetic tree. The non-parasitic flatworms, traditionally grouped as the "Turbellaria", are paraphyletic, as the parasitic Neodermata including the Cestoda arose within that grouping. The approximate times when major groups first appeared is shown in millions of years ago.