Ask a Question related to PHP Development, Design and Development.
-
Jswalter #1
Q on Class and EXTEND
I found a piece of code in the docs, and thought it was a way to EXTEND a
Class with new properties tha cna be accessed from original Class Object.
can someone tell me what I did wrong?
Thx
Walter
=====================
<?php
class THEPARENT {
var $name = null;
function THEPARENT( $newName )
{
$this->name = $newName ;
}
}
class THECHILD extends THEPARENT {
var $abc;
var $xyz = "xyz"; // NOTE: this value will be lost during
unserialization
function _ATOM() {
// NOTE: $this->xyz is now "xyz"
$this = unserialize (serialize (new THEPARENT()));
// NOTE: Original value of $this->xyz is lost
$this->$abc = "abc"; // Better: initialize values after ser/unser.
step
}
}
$a = new THEPARENT ('walter');
echo $a->name . '<p />';
echo $a->abc . '<p />';
?>
Jswalter Guest
-
#38947 [NEW]: Unable to extend mysqli class properly without causing various fatal errors
From: rk at yes-co dot nl Operating system: Debian PHP version: 5.1.6 PHP Bug Type: MySQLi related Bug description: Unable... -
Extend Date Class Flex 2 Beta 3
I want to add some methods to the Date class, like beginOfMonth / endOfMonth which returns the first millisecond and last millisecond of the month... -
Best way to extend contribute
I have an application that extends the menus and toolbars of Contribute 3.11. The only way I found how to do this is to have my installer... -
Extend the DataGrid 2
If I want to add three buttons to the datagrid then what should be the best way to go about it? Extend the DataGrid or create a composite control... -
[PHP] Q on Class and EXTEND
> -----Original Message----- No, I'm wanting to EXTEND the orginal class. meaning, my THECHILD class efines new methods/properties, and I want...



Reply With Quote

