<?php
class Produto {
private $cpu;
private $mb;
private $psu;
public function __construct($cpu, $mb) {
$this->cpu = $cpu;
$this->mb = $mb;
}
function getCpu() {
return $this->cpu;
}
function setCpu($cpu) {
$this->cpu = cpu;
}
function getMb() {
return $this->mb;
}
function setMb($mb) {
$this->mb = mb;
}
}
$produto = new Produto('Core i7 7700', 'Z270');
echo $produto->getCpu();
?>
//https://pt.stackoverflow.com/q/237154/101
PD9waHAKY2xhc3MgUHJvZHV0byB7CiAgICBwcml2YXRlICRjcHU7CiAgICBwcml2YXRlICRtYjsKICAgIHByaXZhdGUgJHBzdTsKICAgIHB1YmxpYyBmdW5jdGlvbiBfX2NvbnN0cnVjdCgkY3B1LCAkbWIpIHsKICAgICAgICAkdGhpcy0+Y3B1ID0gJGNwdTsKICAgICAgICAkdGhpcy0+bWIgPSAkbWI7CiAgICB9CiAgICBmdW5jdGlvbiBnZXRDcHUoKSB7CiAgICAgICAgcmV0dXJuICR0aGlzLT5jcHU7CiAgICB9IAogICAgZnVuY3Rpb24gc2V0Q3B1KCRjcHUpIHsKICAgICAgICAkdGhpcy0+Y3B1ID0gY3B1OwogICAgfSAKICAgIGZ1bmN0aW9uIGdldE1iKCkgewogICAgICAgIHJldHVybiAkdGhpcy0+bWI7CiAgICB9IAogICAgZnVuY3Rpb24gc2V0TWIoJG1iKSB7CiAgICAgICAgJHRoaXMtPm1iID0gbWI7CiAgICB9IAp9CgokcHJvZHV0byA9IG5ldyBQcm9kdXRvKCdDb3JlIGk3IDc3MDAnLCAnWjI3MCcpOwplY2hvICRwcm9kdXRvLT5nZXRDcHUoKTsKPz4KCi8vaHR0cHM6Ly9wdC5zdGFja292ZXJmbG93LmNvbS9xLzIzNzE1NC8xMDE=