User Profile

Collapse

Profile Sidebar

Collapse
santiagofs
santiagofs
Last Activity: Sep 28 '09, 05:20 AM
Joined: Aug 8 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • santiagofs
    replied to Dynamic class inheritance
    in PHP
    Atli, thank you. I didn't know you could use conditionals for class extension. I think it not applies to my current problem, but sure it will be usefull.

    Markus, I agree with you that composition must be favored over inheritance: a Person is not an Arm or a Leg, a Person Has an Arm and Has a Leg.

    But only when the HAS A really applies: a Diver could HAVE Equipment but IS a Person.

    Object composition has...
    See more | Go to post

    Leave a comment:


  • santiagofs
    replied to Dynamic class inheritance
    in PHP
    Dormilich, thanks for your replay


    I understand interfaces are a way to implement pseudo multiple inheritance. Probably I'm wrong.



    I know you can have the child classes you want:
    Users extends List extends Edit extends Table (where List, Edit and Table are kind of abstract and Users do the overrides needed).
    But you came with a Users class having a lot of functionallity you dont need...
    See more | Go to post

    Leave a comment:


  • santiagofs
    replied to Dynamic class inheritance
    in PHP
    I understand it may be not make sense to you. Lets try explain it a bit more.
    As you say, I'm creating several instances of the table class to resemble each of the tables.
    But each of this classes may be used in different contexts: managing lists and editing records on a CMS, presenting data to the user, make summarys, manage translations, etc.

    You can create a base class which do all that things, but you obtain a single...
    See more | Go to post

    Leave a comment:


  • santiagofs
    started a topic Dynamic class inheritance
    in PHP

    Dynamic class inheritance

    Hi, I want to know if it is any workaround for this:

    I have a class which models a database table behavior (table abstract class)
    I have several clases wich extends the table abstract class, providing information about their fields. The name of this classes are the names of the tables on the database. (users, stock, sales, etc)

    I want to have a class wich provide additional functionality to each the users, stock,...
    See more | Go to post
No activity results to display
Show More
Working...