[nycphp-talk] Static variables, self:: and abstract classes
edwardpotter at gmail.com
Wed Jun 7 11:42:24 EDT 2006
So, JUST FOR FUN! how would you do it with no objects? (I just
finished my grad work, a professor could pull that one on you). :-)
On 6/7/06, Andrew Kamm <akamm at demicooper.com> wrote:
> >just one question had crossed my mind right now...
> >why did u had declared the variable as static?
> The idea was to have an abstract parent class for customer preferences since
> most preference classes would basically share the same code. The static
> vars (or constants) that were to be stored in the individual classes were
> properties that differentiate how the child classes would interact with the
> database (among other things).
> Some of the methods within the classes were not object-specific, but rather
> class-specific operations (like a getList() method to get a an array of
> options for a specific type of preference (class) rather than something
> related to an actual object instance).
> For example: customerPreference has child class 'beds' which can be
> referenced statically for information about 'beds' in general or you could
> instantiate a 'beds' object that refers to '2-bedroom' or '4-bedroom', etc.
> Some of the vars I was attempting to store as static (or as constants) were
> things like "tableName", "linkTableName", "isMult", etc.
> Andrew Kamm
> New York PHP Community Talk Mailing List
> New York PHP Conference and Expo 2006
> Show Your Participation in New York PHP
More information about the talk