Hi

When dealing with a class (Class A) that is extended by a number of other
classes (Child 1, Child2...), each of which has their own non-inherited
properties and methods, what is the general consensus on the best way to add
a parameter to the constructor of the parent class?

The problem I'm currently facing is that if I extend Class A and modify the
constructor to accept an extra argument (Class A-ext), then Child 1 needs to
extend Class A-ext so it can pass the new argument through in its super()
call. But then I need to duplicate all non-inherited properties and methods
of Child 1 into the newly created extended version of Child 1.

So it seems to me that I either edit the original classes directly, which
makes them potentially incompatible with the same codebase deployed on other
projects, or I duplicate them and have two sets of almost identical code to
maintain.

Anyone got any suggestions for best practice when it comes to this sort of
thing?

Thanks
Tim


--
Tim Stickland
Include Digital | Director
2nd Floor, 145-157 St. John Street, London EC1V 4PY

tel: +44 (0) 20 7526  4611
web: http://www.include-digital.com
blog: http://blog.include-digital.com


_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to