<?php
// a)
class LongName {
var $firstname = " ";
var $middlename = " ";
var $lastname = " ";
function firstname($string) {
echo "First Name : ". $string;
}
function middlename() {
if (middlename){
echo "Middle Name : ". $this -> middlename;
}
else
{
echo "Middle name, what is that? ";
}
}
function lastname() {
echo "Last Name : ". $this -> lastname;
}
}
// b)
class Firstname2 extends LongName {
function firstname()
{
echo "First Name: ".$param;
}
}
// c)
class lastname2 extends LongName {
function lastname()
{
echo "Last Name: ".$param;
}
}
// d)
$firstname = new LongName;
$LongName -> firstname = 'David';
$lastname = new LongName;
$LongName -> lastname = 'Gunarso';
$firstname = new firstname2;
$firstname2 -> firstname = 'David';
$lastname = new lastname2;
$lastname2 -> lastname = 'Gunarso';
?>
Strict Standards: Declaration of Firstname2::firstname() should be compatible with that of LongName::firstname() in C:\xampp\htdocs\php_exercise\exercise2_3.php on line 39
Strict Standards: Creating default object from empty value in C:\xampp\htdocs\php_exercise\exercise2_3.php on line 54
Strict Standards: Creating default object from empty value in C:\xampp\htdocs\php_exercise\exercise2_3.php on line 60
Strict Standards: Creating default object from empty value in C:\xampp\htdocs\php_exercise\exercise2_3.php on line 63
Many errors. Why? I basically trying to call the function and want to see outputs.
Thanks before.