So am i to understand that i will have to do it in this manner?

class A {
        var $b;
        A() {
        }

        function getB() {
                return $this->B;
        }
        function setB($b) {
                $this->B = $b;
        }
}

class B extends A {
        B($b) {
                parent::setB($b);
        }
}

$B = new B();
echo $B->getB();

This means writing a get and set function for every property that belongs to
the parent. I understand this is how it is done in other languages but the
manual is misleading in this case.  It explicity says "Sometimes it is
useful to refer to functions and variables..".  This lead me to believe that
you could directly access VARIABLES as well as functions.  I guess i was
wrong.  Oh well, it just means more typing for me, which means more hours,
which means more $.

-Jared


-----Original Message-----
From: Tobyn Baugher [mailto:[EMAIL PROTECTED]]
Sent: Monday, June 03, 2002 12:30 PM
To: php list
Subject: Re: [PHP] Question regarding :: syntax


On Mon, 2002-06-03 at 12:06, Jared Boelens wrote:

> Is there not a way to refer directly to the parent properties?  Or do i
have
> to setup a get function for every parent var that I want to access.

Tis my understanding that you cannot refer to class properties without
an instance of the class. If I were wrong it would make my life much
easier, but I don't believe I am.

Regards,

Toby



--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to