Can we call the constructor of a class more than once for an object?
Constructor is called automatically when we create an object using new keywor...
Can we call the constructor of a class more than once for an object?
Constructor is called automatically when we create an object using new keyword. It's called only once for an object at the time of object creation and hence, we can't invoke the constructor again for an object after its creation. a) Only afirmation 1 is correct. b) Only afirmation 2 is correct. c) Afirmations 1 and 2 are correct. d) None of the afirmations are correct.
No, não podemos chamar o construtor de uma classe mais de uma vez para um objeto. O construtor é chamado automaticamente apenas uma vez, no momento da criação do objeto usando a palavra-chave "new". Portanto, a afirmativa correta é a letra d) Nenhuma das afirmações está correta.
0
0
Faça como milhares de estudantes: teste grátis o Passei Direto
Compartilhar