6
I was looking into this question done in SOEN. There is teaching to instantiate a certain class.
I was able to understand more or less how it works, because when I use my example, it is giving error when compiling.
class Pessoa {
int idade;
float tamanho;
};
int main()
{
Pessoa pessoa = new Pessoa();
}
However the following error appears:
error: Conversion from ːPessoa*' to non-scalar type ːPessoa' requested Person person = new Person ();
Error is fixed when I put an asterisk in front of the word Pessoa
.
Pessoa* pessoa = new Pessoa ();
So, what is the function of the asterisk in this case? What does it indicate?
It’s a good question, but it deserved someone’s -1. Happy 2016, srsrsrsrsrsrsrs.
– Wallace Maxters