first approach for class hierarchy implemented