Is it possible to split class definition over two files?

Is it possible to split class definition over two files?

am 08.09.2007 18:22:16 von D_a_n_i_e_l

Is it possible to split a class definition over two files?

Thanks.

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

am 08.09.2007 21:08:03 von Jerry Stuckle

D_a_n_i_e_l wrote:
> Is it possible to split a class definition over two files?
>
> Thanks.
>

No.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

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

am 09.09.2007 23:56:26 von gosha bine

D_a_n_i_e_l wrote:
> Is it possible to split a class definition over two files?
>
> Thanks.
>

No, but it's always possible to split one big class into several ones
and use inheritance.


--
gosha bine

extended php parser ~ http://code.google.com/p/pihipi
blok ~ http://www.tagarga.com/blok

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

am 10.09.2007 04:39:58 von Bucky Kaufman

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.

Beyond that, I use EXTENDS all the time to use more than one file to
define a class.

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

am 10.09.2007 10:46:00 von luiheidsgoeroe

On Mon, 10 Sep 2007 04:39:58 +0200, Sanders Kaufman
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
class foo{
include('/path/to/body.php');
}
?>
body.php
function bar(){echo 'foobar';}
?>

or this:

file1.php
class foo{
?>
file2.php
function bar(){ return false;}
}
?>
glueclasstogether.php:
include('file1.php');
include('file2.php');
?>


--
Rik Wasmus

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

am 10.09.2007 13:58:16 von Jerry Stuckle

Sanders Kaufman 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.
>
> Beyond that, I use EXTENDS all the time to use more than one file to
> define a class.
>

extending a class creating a new class, not splitting the current
definition across multiple files.

Let's see your code which splits a class across multiple files.

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================