« Return to Thread: Redefining base class functions?

Re: Redefining base class functions?

by kksou :: Rate this Message:

Reply to Author | View in Thread

Benjamin Smith wrote:
Is there a way (PHP-GTK1) to redefine a base class method? Specifically, I
need to change set_usize() so that the values for X and Y can be
recalculated.
Hi Ben,

Don't think PHP-GTK1 or PHP-GTK2 allows you to redefine a base class or override an existing class method.

If you really need something like this now, maybe you could try this.

1) Do a global find and replace to change all set_usize($x, $y)  to my_set_usize($x, $y)
2) Then define my_set_usize($x, $y) as what you've wanted
function my_set_usize($x, $y) {
    set_usize(round($x * SIZEMULTIPLIER), round($y * SIZEMULTIPLIER));
}

I know the solution is primitive and not your ideal solution. But at least you have something working till they allow you to override existing methods.

Regards,
/kksou

 « Return to Thread: Redefining base class functions?