Skip to content

Instantly share code, notes, and snippets.

@fabioluciano
Created February 11, 2012 06:11
Show Gist options
  • Select an option

  • Save fabioluciano/1796983 to your computer and use it in GitHub Desktop.

Select an option

Save fabioluciano/1796983 to your computer and use it in GitHub Desktop.
<?php
class PessoaJuridica extends Pessoa {
protected $nome;
public function __construct($nome) {
$this->nome = $nome;
}
}
$pessoajuridica = new PessoaJuridica('Coisa Inc.');
$pessoa = new Pessoa();
print $pessoa->contratar($pessoajuridica);
/*
Catchable fatal error: Argument 1 passed to Pessoa::contratar() must be an instance of PessoaFisica, instance of PessoaJuridica given
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment