Begin by slicing the potatoes, cubing the cooked ham, and shredding the cheddar cheese.
In a skillet, sauté chopped onion and minced garlic in butter until fragrant.
In a casserole dish, layer sliced potatoes, cubed ham, and sautéed onion and garlic.
Sprinkle a generous layer of shredded cheddar cheese over the casserole.
Create another layer with the remaining ingredients: potatoes, ham, onion, garlic, and cheese.
Pour heavy cream over the casserole to ensure a creamy and rich texture.
Season the casserole with salt and pepper to taste.