Public of course. Having new call private methods doesn't solve anything, and certainly isn't a choice of style. (Unless you have the bottom _init call SUPER::_init, but then it isn't private anymore, is it?)
I would also argue (again a matter of preference and style) that FloorWaxDessertTopping might be better off inheriting from a ThingsThatCanGoOnTopOfOtherThings base class if it's parents are so different.
Rewriting classes into different classes so "it's better off inheriting" isn't code reuse, is it? It "reinventing the wheel".
Code reuse is this: Given some code, possibly written by something else, (re-)use it. Code reuse isn't "Hmmm, here's some code I may be able to reuse. Let's rewrite it for scratch, but then differently". The FloorWax and DessertToppings are given. Maybe written by your team member. Maybe written by some other department. Maybe you found it on CPAN. | [reply] [d/l] [select] |
Sure, if this is what you have been given and you can't change it then I would not rewrite the whole class architecture either. I was more refering to a situation where you do make the choices. Anyway, I don't think I'm the only one who ever used a private _init method and I also wouldn't say that there arent' scenarios where a public init method isn't the right way to go. That's what I meant with choices of design/style.
| [reply] |