Hello coders, I am looking for solutions in this (not for me) easy assignment OOP:
[php]<?php
class User{
private $id;
private $first_name;
private $last_name;
private $age;
public function __construct($id,$first_name,$last_name,$age){
$this->id = $id;
$this->first_name = $first_name;
$this->last_name = $last_name;
$this->age = $age;
}
public function show() {
return "Id = " . $this->id . ";Hellooo my name is:" . $this->first_name . " " . $this->last_name . ".I am". $this->age . "years old. I am glad to meet you :-)";
}
public function getAge(){
$this->age = $age;
}
}
$korisnik = new User(2,"Bojan", "Nikolic", 33);
echo "<br>";
echo $korisnik->show();
echo $korisnik->getAge(15);[/php]
Method “show” should return the value of the properties class name. - Method “getAge” should not have multiple parameters depending on the value of the properties Age that has an object that returns true or false. I dont understand to do this alone…can someone help me with this?