Basket basket = new Basket(); basket.setElement(new Apple()); Apple apple = basket.getElement();