It doesn't follow simple genetics. But it does seem to run in some families and there probably are hereditary factors that predispose to it. It would be more like diabetes
. You may have a predisposition due to heredity but watching your weight and exercising may prevent you from developing diabetes.