For Programmers: Free Programming Magazines  


Home > Archive > PHP Language > October 2004 > Re: defining a class/instantiating object inside a method of another class









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: defining a class/instantiating object inside a method of another class
Berislav Lopac

2004-10-19, 3:57 am

On Tue, 19 Oct 2004 04:07:11 GMT, Lüpher Cypher wrote:

> Taking the whole thing outside of the class definition is not going to
> work - suppose I have many subclasses of this class, each with its own
> file, then for every class I'd have to provide a separate function
> outside the class definition to read the file.


No, just include the class definition file anywhere, even inside the
function block. As PHP is parsed and compiled before it's executed, class
definitions are valid for whole program, regardless of where they are
defined.

Berislav
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com