I have two classes created within the same namespace
, being:
public class Pessoa
{
public int idPessoa { get; set;}
public string nome { get; set;}
}
public class PessoaFisica
{
public Pessoa pessoa { get; set;}
public string cpf { get; set; }
public string rg { get; set; }
}
But when I try to use the PessoaFisica
class, I get the error message:
Object reference not set to an instance of an object.
How do I instantiate the Pessoa
class within the PessoaFisica
class without having to use the new
operator?
The 'Person' and 'Person' classes have the function of DTO. Consequently, they will be used by other classes of business rules to popularize the DataGrids of suppliers, customers and etc.