Re: [PHP] OOP Question

2004-04-07 Thread Robert Cummings
On Wed, 2004-04-07 at 17:07, Richard Lewis wrote: > What do members think that this code should do: > > class A > { > var $a, $b; > function A($a) > { > $this->$a = $a; > } > function prnt() > { > echo "a=" . $this->$a; > } > } > > class B extends A > { > function B($a, $b

Re: [PHP] OOP question

2003-06-01 Thread Ernest E Vogelsinger
Just noticed a small glitch in the attach() method - check_object will not be called for the first object. Use this attach() / check_object() implementation instead. The "var $class" instance variable of CTeeObject can be omitted. function attach(&$hObj) { if (!$this->check_object($hObj))

Re: [PHP] OOP question

2003-06-01 Thread Ernest E Vogelsinger
At 08:39 01.06.2003, Jackson Miller said: [snip] >Is it possible to reference two instances of an object at once with a >single variable name while retaining the ability to reference the >objects seperately? [snip] No

Re: [PHP] OOP question

2003-06-01 Thread Rasmus Lerdorf
On Sat, 1 Jun 2003, Jackson Miller wrote: > Is it possible to reference two instances of an object at once with a > single variable name while retaining the ability to reference the > objects seperately? No chance. Well, you could hack it with some really fancy object overloading, but in general,

Re: [PHP] OOP Question in PHP

2002-06-06 Thread Ilker Cetinkaya
"Scott Hurring" <[EMAIL PROTECTED]> wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > Depends ;-) yea, really depnds, but as you mentioned, having parameterless constructors are more generic, especially when it comes to derive the classes. > > instead (with option #2), you could

Re: [PHP] OOP Question in PHP

2002-06-05 Thread Daniel Tryba
On Wed, Jun 05, 2002 at 10:32:39PM +0100, Henry Blackman wrote: > Do I create a new document and pass the primary key as it's a variable in > the > > $document = new Document(number); > > and have the constructor retrieve the appropriate data from MySQL and fill > the attribute variables. > > O

RE: [PHP] OOP Question in PHP

2002-06-05 Thread Scott Hurring
Depends ;-) I'd say that the second way is probably "best", becuase it avoids implied behaviour, which sometimes can cause problems (lets say you want to init. a document object, but not get anything from the DB). If you want to create a brand new Document, obviously it won't be in the DB alread

Re: [PHP] OOP question regarding class extension

2001-03-19 Thread Matt McClanahan
On Mon, Mar 19, 2001 at 01:58:39PM -0500, Altunergil, Oktay wrote: > As far as I know a class can extend multiple classes. What you can't do -in > PHP- is two create a class that inherits from multiple parent classes > (multiple inheritence). I believe this is available in C++ and Java and > othe

RE: [PHP] OOP question regarding class extension

2001-03-19 Thread Altunergil, Oktay
As far as I know a class can extend multiple classes. What you can't do -in PHP- is two create a class that inherits from multiple parent classes (multiple inheritence). I believe this is available in C++ and Java and others. I also think the reason it is not available in PHP is because inheriting