now using inheritance 1D, 2D cases