[PHP] oop problems code

2003-09-18 Thread ORLANDO POZO
Hello, mailing list, I have problem with this oop code:

?

class Person {
  var $name, $address, $age;
  function Person($name, $address, $age) {
$this-name = $name;
$this-address = $address;
$this-age = $age;
  }
}
Class Employee extends Person {
  var $position, $salary;
  function Employee($name, $address, $age, $position, 
$salary) {
$this-Person($name, $address, $age);
$this-position = $position;
$this-salary = $salary;
  }
}

Class Displayer extends Employee {
 function DisplayEmployee() {
  echo Name:  . $this-name . br;
  echo Address:  . $this-address . br;
  echo Age:  . $this-age . br;
  echo Position:  . $this-position . br;
  echo Salary:  . $this-salary . br;
 }
}
$obj1 = new Employee(Orlando J Pozo P,Calle 75 AV 
9B-10,20,Computer Engineer,$2000);
$obj2 = new Displayer;
$obj2-DisplayEmployee();

?

--
the output of it is:
Warning: Missing argument 1 for employee() in 
C:\htdocs\ojpp\poo\3\practica\Copy of 18.php on line 16

Warning: Missing argument 2 for employee() in 
C:\htdocs\ojpp\poo\3\practica\Copy of 18.php on line 16

Warning: Missing argument 3 for employee() in 
C:\htdocs\ojpp\poo\3\practica\Copy of 18.php on line 16

Warning: Missing argument 4 for employee() in 
C:\htdocs\ojpp\poo\3\practica\Copy of 18.php on line 16

Warning: Missing argument 5 for employee() in 
C:\htdocs\ojpp\poo\3\practica\Copy of 18.php on line 16
Name: 
Address: 
Age: 
Position: 
Salary: 

--

  I don't know what happen in this code, because, the 
last inheritance (Displayer Class) that I made, it is 
inherited the properties and methods of the Employee 
Class, and as Employee Class is also inherited the 
functionality of the parent class, the Displayer Class 
would be inherit this functionality, too.

  thanks if any could help me, regards, bye.

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


Re: [PHP] oop problems code

2003-09-18 Thread Leif K-Brooks
ORLANDO POZO wrote:

Hello, mailing list, I have problem with this oop code:

[snip bad code]

-- 

the output of it is:
[snip output]

-- 

  I don't know what happen in this code, because, the last inheritance 
(Displayer Class) that I made, it is inherited the properties and 
methods of the Employee Class, and as Employee Class is also inherited 
the functionality of the parent class, the Displayer Class would be 
inherit this functionality, too.

  thanks if any could help me, regards, bye.

If a class doesn't define a constructor, the constructor of its parent 
is used; the inherited constructor of displayer wants 6 parameters. 
Also, your code wouldn't do anything useful, since you don't set the 
values of $obj2 (did you expect it to get values from $obj1?).

--
The above message is encrypted with double rot13 encoding.  Any unauthorized attempt 
to decrypt it will be prosecuted to the full extent of the law.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php