<?php
class Pessoa {
private $nome;
private $idade;
private $sexo;
public function __construct($stringNome, $stringIdade, $stringSexo) {
$this->nome = $stringNome;
$this->idade = $stringIdade;
$this->sexo = $stringSexo;
}
}
class Funcionario extends Pessoa {
private $empresa;
private $salario;
public function __construct($stringNome, $stringIdade, $stringSexo, $stringEmpresa, $stringSalario) {
parent::__construct($stringNome, $stringIdade, $stringSexo);
$this->empresa = $stringEmpresa;
$this->salario = $stringSalario;
}
}
$vendedor = new Funcionario("Yuri", "19", "Masculino", "Tam", "3000");
?>
//https://pt.stackoverflow.com/q/247363/101
PD9waHAKY2xhc3MgUGVzc29hIHsgICAgIAoJcHJpdmF0ZSAkbm9tZTsKCXByaXZhdGUgJGlkYWRlOwoJcHJpdmF0ZSAkc2V4bzsgIAoJcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRzdHJpbmdOb21lLCAkc3RyaW5nSWRhZGUsICRzdHJpbmdTZXhvKSB7CgkJJHRoaXMtPm5vbWUgID0gJHN0cmluZ05vbWU7CgkJJHRoaXMtPmlkYWRlID0gJHN0cmluZ0lkYWRlOwoJCSR0aGlzLT5zZXhvICA9ICRzdHJpbmdTZXhvOyAKCX0gIAp9IAoKY2xhc3MgRnVuY2lvbmFyaW8gZXh0ZW5kcyBQZXNzb2EgeyAKCXByaXZhdGUgJGVtcHJlc2E7Cglwcml2YXRlICRzYWxhcmlvOwoJcHVibGljIGZ1bmN0aW9uIF9fY29uc3RydWN0KCRzdHJpbmdOb21lLCAkc3RyaW5nSWRhZGUsICRzdHJpbmdTZXhvLCAkc3RyaW5nRW1wcmVzYSwgJHN0cmluZ1NhbGFyaW8pIHsKCQlwYXJlbnQ6Ol9fY29uc3RydWN0KCRzdHJpbmdOb21lLCAkc3RyaW5nSWRhZGUsICRzdHJpbmdTZXhvKTsKCQkkdGhpcy0+ZW1wcmVzYSA9ICRzdHJpbmdFbXByZXNhOwoJCSR0aGlzLT5zYWxhcmlvID0gJHN0cmluZ1NhbGFyaW87ICAgICAKCX0KfQoKJHZlbmRlZG9yID0gbmV3IEZ1bmNpb25hcmlvKCJZdXJpIiwgIjE5IiwgIk1hc2N1bGlubyIsICJUYW0iLCAiMzAwMCIpOwo/PgoKLy9odHRwczovL3B0LnN0YWNrb3ZlcmZsb3cuY29tL3EvMjQ3MzYzLzEwMQ==