Posted by Rik Wasmus on 09/10/07 08:46
On Mon, 10 Sep 2007 04:39:58 +0200, Sanders Kaufman <bucky@kaufman.net>
wrote:
> Jerry Stuckle wrote:
>> D_a_n_i_e_l wrote:
>>> Is it possible to split a class definition over two files?
>>>
>>> Thanks.
>> No.
>
> Really?
>
> I have a class right now that uses at least 3 different files, through
> if-include-else-include's.
Inside methods, offcourse it's possible (allthough if/else structures
often (not always!) indicate a flaw in OO design). What is not possible is
this:
class.php
<?php
class foo{
include('/path/to/body.php');
}
?>
body.php
<?php
function bar(){echo 'foobar';}
?>
or this:
file1.php
<?php
class foo{
?>
file2.php
<?php
function bar(){ return false;}
}
?>
glueclasstogether.php:
<?php
include('file1.php');
include('file2.php');
?>
--
Rik Wasmus
[Back to original message]
|