Is it possible to split class definition over two files? - PHP

This is a discussion on Is it possible to split class definition over two files? - PHP ; Is it possible to split a class definition over two files? Thanks....

+ Reply to Thread
Results 1 to 6 of 6

Is it possible to split class definition over two files?

  1. Default Is it possible to split class definition over two files?

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

    Thanks.


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

    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
    ==================

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

    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

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

    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.


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

    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

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

    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
    ==================

+ Reply to Thread

Similar Threads

  1. Why is ; used at the end of class definition.
    By Application Development in forum c++
    Replies: 9
    Last Post: 07-28-2007, 05:43 PM
  2. Replies: 2
    Last Post: 07-12-2007, 06:53 PM
  3. Class definition location??
    By Application Development in forum DOTNET
    Replies: 3
    Last Post: 07-11-2007, 09:10 AM
  4. class definition recursion?
    By Application Development in forum c++
    Replies: 10
    Last Post: 06-14-2007, 04:29 PM
  5. Re: What if the implementation of a class is split into separate files
    By Application Development in forum Compilers
    Replies: 0
    Last Post: 07-17-2004, 05:07 PM