Fórum Praticando PHP com POO #608251
18/02/2020
0
Fatal error: Uncaught Error: Call to private method Player::setName() from context '''''''' in C:\xampp\htdocs\tracker\test.php:6 Stack trace: #0 thrown in C:\xampp\htdocs\tracker\test.php on line 6
test.php
<?php include ''''Model/Player.php''''; $nome = ''''teste''''; Player::setName($nome); ?>
Player.php
<?php
class Player {
private $id;
private $name;
private $former_names;
private $title;
private $sex;
private $voc;
private $level;
private $exp;
private $achievement_points;
private $world;
private $last_login;
private $account_status;
private $former_world;
private $guild;
private $married_to;
private $house;
private $deaths;
private $record_exp;
public function getId(){
return $this->id;
}
public function setId($id){
$this->id = $id;
}
private static function getName(){
return $this->name;
}
private static function setName($name){
$this->name = $name;
}
public function getFormerNames(){
return $this->former_names;
}
public function setFormerNames($former_names){
$this->former_names = $former_names;
}
public function getTitle(){
return $this->title;
}
public function setTitle($title){
$this->title = $title;
}
public function getSex(){
return $this->sex;
}
public function setSex($sex){
$this->sex = $sex;
}
public function getVoc(){
return $this->voc;
}
public function setVoc($voc){
$this->voc = $voc;
}
public function getLevel(){
return $this->level;
}
public function setLevel($level){
$this->level = $level;
}
public function getExp(){
return $this->exp;
}
public function setExp($exp){
$this->exp = $exp;
}
public function getAchievementPoints(){
return $this->achievement_points;
}
public function setAchievementPoints($achievement_points){
$this->achievement_points = $achievement_points;
}
public function getWorld(){
return $this->world;
}
public function setWorld($world){
$this->world = $world;
}
public function getLastLogin(){
return $this->last_login;
}
public function setLastLogin($last_login){
$this->last_login = $last_login;
}
public function getAccountStatus(){
return $this->account_status;
}
public function setAccountStatus($account_status){
$this->account_status = $account_status;
}
public function getFormerWorld(){
return $this->account_status;
}
public function setFormerWorld($former_world){
$this->former_world = $former_world;
}
public function getGuild(){
return $this->guild;
}
public function setGuild($guild){
$this->guild = $guild;
}
public function getMarriedTo(){
return $this->married_to;
}
public function setMarriedTo($married_to){
$this->married_to = $married_to;
}
public function getHouse(){
return $this->house;
}
public function setHouse($house){
$this->house = $house;
}
public function getDeaths(){
return $this->deaths;
}
public function setDeaths($deaths){
$this->deaths = $deaths;
}
public function getRecordExp(){
return $this->record_exp;
}
public function setRecordExp($record_exp){
$this->record_exp = $record_exp;
}
}
?>
Guilherme Brites
Curtir tópico
+ 0Posts
20/02/2020
Guilherme Brites
Gostei + 0
20/02/2020
Paulo Carvalho
Acho que faltou instanciar a classe player, não faltou não?
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)