What is the correct way to model a Client class that can be PF or PJ?

Asked

Viewed 25 times

0

I’m trying to model a Client class and the way I did I don’t know if it would be right, because I don’t know how to create the client class that can be both PF and PJ, follows below the modeling of the Person, Personal and Personal.

public abstract class Pessoa
{
    public int Id { get; set; }
    public TipoPessoa Tipo { get; set; }
}

public enum TipoPessoa
{
    Fisica = 1,
    Juridica = 2
}

public class PessoaFisica : Pessoa
{
    public string Nome { get; set; }
    public string CPF { get; set; }
    public string RG { get; set; }
    public int Idade { get; set; }
}

public class PessoaJuridica : Pessoa
{
    public string NomeFantasia { get; set; }
    public string RazaoSocial { get; set; }
    public string CNPJ { get; set; }
}

How I would create a customer class in this case?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.