I find it a little strange ClienteJuridico
, and ClienteFisico
, inherit from Pessoa
. Not totally absurd, but it seems conceptually wrong, maybe it’s just a matter of name. Will these people one day not be able to be suppliers or have other roles? It will be weird. But that’s not the problem.
Do you have to decide, want to inherit or want to compose? They are essentially antagonistic. A NotaFiscal
is a ClienteJuridico
? How? I can’t imagine how this is possible, so inheritance seems discarded. The composition seems adequate. But there are problems. I can’t imagine why a customer should have a reference to a bill object. I also find it strange that the NF allows having both CPF and CNPJ.
The inheritance of NotaFiscal
in Vendas
It seems even more absurd (I’m not sure what this class does). My suggestion is to revise your concept of inheritance. There is material on the subject here on the site.
And I notice other problems in the model, but they are details that are not the focus of the question.
Note that the use of the term attribute is correct because this is UML, but when referencing in the language that’s called a field.