Inheritance is one way to go, but it should only be used when there is a clear inheritance relationship between the objects being modeled. A more common solution would be to just put the shared code in a separate utility class and have the other classes use that.