Date: 03/27/01
- Next message: Hojtsy Gabor: "Re: [PHP-DOC] resources.xml errors"
- Previous message: James Moore: "RE: [PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- In reply to: Andrei Zmievski: "Re: [PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- Next in thread: Daniel Beckham: "[PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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.
:)
- Next message: Hojtsy Gabor: "Re: [PHP-DOC] resources.xml errors"
- Previous message: James Moore: "RE: [PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- In reply to: Andrei Zmievski: "Re: [PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- Next in thread: Daniel Beckham: "[PHP-DOC] cvs: phpdoc /en/functions classobj.xml"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]

