1
I need help when it comes to object orientation.
I need to implement the class Parcelable
in the model Produto
, but for the sake of organization, I would not like to implement directly in the class Produto
and create a new class ProdutoParcelable
and implement there and make the class Produto
identify that implementation or "become" that implementation.
The detail is that in the possible class ProdutoParcelable
I’ll need the class attributes Produto
.
public class Produto extends ProdutoParcelable
public class ProdutoParcelable implements Parcelable
//Aqui vou precisar dos atributos de Produto
If in this class you will need the attributes of the child class, your abstraction of the problem is wrong. What would be the goal of dividing into different classes?
– Woss
@Andersoncarloswoss The goal would be simply organization. Leave the Product class cleaner. Thank you.
– Rafa Yaw
So why not define the attributes of
Produto
which will be needed inProdutoParcelable
directly in this class?– Woss
@Andersoncarloswoss I will try! Thank you for your attention!
– Rafa Yaw