If an animal does not have four legs, It still can be a mammal. The definition of a mammal is a warm-blooded vertebrate animal that possesses hair or fur, secretion of milk by females for the nourishment of the young, and (typically) the birth of live young. By this definition, both whales and porpoises are mammals, and they do not have four legs.