/*
 * @topic T11356 Cloneable class demo II
 * @brief Cloneable class Product -- shallow copy
*/

package products;

public class Product implements Cloneable {

    int code;
    StringWrapper title; // aggregates instance of another class
    double price;

    // constructors
    public Product(
            int code,
            String description,
            double price) {
        this.code = code;
        title = new StringWrapper( description );
        this.price = price;
    }

    @Override
    public Object clone()
            throws CloneNotSupportedException
    {
        // Invokes Object.clone()
        return super.clone();
    }

    public String getDescription()
    {
        return title.getText();
    }

    public void setDescription( String descr )
    {
        title.setText(descr);
    }

}//class Product