What about something like this...

Class foo {
        
        var $myfoo;     // "Private" variable
        pubvar $myfoo2; // "Public" variable


}

Class bar extends foo {

        pubvar $mystuff;

}

$a = new foo();
$a->setmyfoo2(5);
echo $a->getmyfoo2();

$b = new bar();
$b->setmyfoo2(10);
$b->setmystuff(20);

The point here is that pubvar automatically creates get* and set*.. As
far as overloading, etc is concerned, there would be no need to worry
about it -- the point of these functions is not to overload them (they
should simply be used to get and set member variables)... 

John

|-----Original Message-----
|From: Shane Caraveo [mailto:shane@;caraveo.com] 
|Sent: Tuesday, November 12, 2002 10:04 PM
|To: Alan Knowles
|Cc: [EMAIL PROTECTED]
|Subject: Re: [PHP-DEV] prototypes for getters and setters.
|
|
|Alan Knowles wrote:
|
|> Shane Caraveo wrote:
|>
|> >>
|> >>
|> >> Anyway before I get carried away and actually test this :) -
|> anybody got
|> >> any thoughts.....
|> >>
|> >> Regards
|> >> Alan
|> >
|> >
|> >
|> >
|> > What's wrong with how overload does this?
|>
|>
|> it has a slight downside in clarity of code - eg. where is that 
|> method..
|>
|But it (overload) also does not introduce new syntax, requires no 
|changes to the engine, is genericly overrideable in extensions, etc. 
|etc. etc.
|
|Shane
|
|
|-- 
|PHP Development Mailing List <http://www.php.net/>
|To unsubscribe, visit: http://www.php.net/unsub.php
|
|


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to