Hi
I've been aware of an interesting thread on phpbuilder
about the "::" operator. This operator is not yet documented,
nor in operator.xml, nor in classobj.xml.
This may be a good idea to add this. If this was planned already
(some changes seem pretty fresh, aren't they?), just tell me.
Here is the URL
http://www.phpbuilder.com/annotate/message.php3?id=1002995
Thrad is copied at the end of this mail.
Any opinion?
Damien Seguy
*********************************************************
Message # 1002995:
Date: 01/09/01 05:11
By: greggory
Subject: RE: Overriding methods
Of course it's possible. (With php4 at least :))
As in C++, you use the :: operator.
Let's suppose we have a class:
class foo {
var $x;
function foo( $init ) {
$this->x = $init;
}
function print() {
echo "X has a value of:$x";
}
}
And a second class that extends the first one:
class doh extends foo {
var $y;
function doh( $init_x, $init_y ) {
foo::foo( $init_x );
$this->y = $init_y;
}
function print() {
echo "Y has a value of:$y";
foo::print();
}
}
Just try it with a piece of code:
$obj1 = new foo( 'Hi!' );
$obj1->print();
$obj2 = new doh( 'world', 'Hello ' );
$obj2->print();
Hope this help.
:)