> Is it bad practice for a class to have a variable and method of the same name?
Well, it's a matter of opinion what is and isn't bad practice, but
personally I would never give a variable and a function the same name
- if only to avoid confusion (PHP shouldn't mind if you do so though).
Paul
--
Is it bad practice for a class to have a variable and method of the same name?
For example:
class product {
var $Name;
function Name() {
return stripslashes($this->Name);
}
}
Thanks,
-Ed
This message was se
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
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)
{
parent::A($a);
$this->$b = $b;
}
function prnt()
{
parent::prn
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))
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
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,
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?
I am using the PEAR Template IT package and need to generate two similar
but different results at the same time. I am doing this with two
ins
"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
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
t: Wednesday, June 05, 2002 5:33 PM
> To: [EMAIL PROTECTED]
> Subject: [PHP] OOP Question in PHP
>
>
> Hello.
>
> I have, what is probably a silly, question.
>
> I want to convert my existing scripts to OO - because it's
> the "way to go"
> in term
Hello.
I have, what is probably a silly, question.
I want to convert my existing scripts to OO - because it's the "way to go"
in terms of the huge amount of functionality that they now have (and since
I've never done it before it would be interesting). However I have one
thing that I don't unde
> From: John Guynn [mailto:[EMAIL PROTECTED]]
> Sent: Monday, March 19, 2001 1:47 PM
> To: Php (E-mail)
> Subject: [PHP] OOP question regarding class extension
>
>
> Can one class extend multiple classes? I'm still playing with OOP
> functionality and maybe my logic
onday, March 19, 2001 1:47 PM
To: Php (E-mail)
Subject: [PHP] OOP question regarding class extension
Can one class extend multiple classes? I'm still playing with OOP
functionality and maybe my logic is reversed but I think I need one class to
extend many others.
John Guynn
This email br
Can one class extend multiple classes? I'm still playing with OOP
functionality and maybe my logic is reversed but I think I need one class to
extend many others.
John Guynn
This email brought to you by RFCs 821 and 1225.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-ma
15 matches
Mail list logo