Structures which have the same basic structure (or same basic design) but perform diferent functions are called homologous structures. e.g., forelimbs of reptiles, amphibians, birds and mammals.
Yes, homologous structures are inherited from a common ancestor. As in the above example, the mammals as well as birds, reptiles and amphibians all have four limbs. The basic structure of limbs is similar though it has been modified to perform different functions in various vertebrates. Thus, showing they have evolved from a common ancestor.