Reply to Re: Is it possible to split class definition over two files?

Your name:

Reply:


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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация