I have three classes I am developing, one for time, dates, and calendars.
But if I read the manual correctly, PHP classes do not support multiple inheritance. So the following would be illegal :
class Calendar extends Date extends Time;
But what if Calendar needs access to both the Date and Time classes? Can I then do (using my time class as the base class) something like :
class Date extends Time;
class Calendar extends Date;
Will the Calendar class now inherit, not only the methods in the Date class, but also the methods in the Time class? That should work, no?
Also, I am not sure about the "this" pointer. Lets assume I have this code :
class Date extends Time;
Now if I want the Date class (inside one of it's own functions) to access a Time function (called GetHour) which call is correct :
function FooDate()
{
$var = GetHour();
$var = $this->GetHour();
}
I'm getting inconsistent results here. To my way of thinking, $this->GetHour would be referring to a function inside of the Date class with the same name (if there was one), since "this" points to the current object (in this case, Date). But the interpreter is complaining that if I leave out the "$this->" construction that it can't find GetHour(). Can I also substitute an "explicit" call like :
$var = Time->GetHour();
And what if I actually had two different functions called GetHour, one in each class (not very good technique, I admit). How would I reference each?
Thanks in advance.