Re: splitting a class across separate files?

From: Date: Thu, 08 Feb 2001 16:13:00 +0000
Subject: Re: splitting a class across separate files?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38773@lists.php.net to get a copy of this message
Its called inheritance. rarley.php <?php class rarley_used { function one() { } function two() { } } ?> main_class.php <?php include_once('rarley.php'); class main_class extends rarley_used { function three() { } function four() { } } ?> -- Chris Lee Mediawaveonline.com lee@mediawaveonline.com "Monte Ohrt" <monte@ispi.net> wrote in message news:3A82BF83.8E84D16@ispi.net... > I have a class with many functions. About 80% of these functions are > rarely used, so I'd like to split them out to a separate file and > include them only if a certain condition applies. This way the PHP > compiling is kept to a minimum. How do I make the included functions > members of the current class? > > Example: > > > myclass.php > ----------- > > <?php > > class MyClass { > > function func1() { > if($foo) { > include_once("myclass2.php"); > $this->func2(); // this doesn't work, it won't find func2! > } > } > > } > > ?> > > myclass2.php > ------------ > > <?php > > // I need these functions to be > // members of MyClass... how? > function func2() { > // do something > } > > } > > ?> > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net > For additional commands, e-mail: php-general-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#38773) next »