On Fri, August 4, 2006 11:46 am, Christian Weiske wrote:
> I recently had a problem that could be solved, but in an ugly way:
> Class B extended Class A. Both classes define a method with the same
> name. B called A's constructor, and A called $this->method(). This
> executed B::method(), not A::method() as you would expect it.

Most OOP people expect it to run B::method()

That's rather the whole point of inheritence and subclasses.

If you need to override it, you might be able to use A::method()...
Though the OO purists have made that illegal now, I think. :-;

There may be some kind of get_method() function on a class that you
could use like:
$function = get_method('A', 'method');
user_call_func(array($this, $function));

-- 
Like Music?
http://l-i-e.com/artists.htm


-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to