in reply to Who am I? Inheritance question

why do you want this if/else code in User?

i think good OO design is when the baseclass does not know anything about its childclasses. you should implement the differences in the child classes.

so provide an abstract method in User that the child classes implement. common code can be shared in a private method in user.

or generalize your code for the generic method in User so that this method only requires some member variables that can be set in the childs constructors.

Replies are listed 'Best First'.
Re^2: Who am I? Inheritance question
by kwaping (Priest) on Mar 16, 2006 at 23:37 UTC
    or generalize your code for the generic method in User so that this method only requires some member variables that can be set in the childs constructors.

    Ah, that might do it, I'll try that.

    Update: Yep, that did it, thanks! I set our ($var1,$var2); in User then set $User::var1 = 'foo'; $User::var2 = 'bar'; in Client.

    ---
    It's all fine and dandy until someone has to look at the code.