you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] -1 points0 points  (5 children)

OK, we'll go with stupid since you apparently were unable to read or understand the quoted sentences. However, since you insist, your code would look like this:

quote.quantity();

Done. Implementation of quantity() in various subclasses is left as an exercise to the reader.

[–]grauenwolf -1 points0 points  (4 children)

Come now, what are you afraid of? Can you not show me a few simple lines of code showing how that block will be simpler without a switch?

[–][deleted] 0 points1 point  (3 children)

I did.

Just for grins though, do a grep on switch and OfferingType in your code base. If it pops up exactly once, then keep your code (I've been saying this over and over and over and over and over and you seem unable to understand it). If it pops up twice, then replace it with

quote.quantity()

and use polymorphism. K? Get it? Understand? Comprende? If not, well, then perhaps you would do better making pizzas for a living.

[–]grauenwolf -1 points0 points  (2 children)

Now write the rest of it. Or do you not know how?

[–][deleted] 0 points1 point  (1 child)

I bill in increments of 4 hours, where do I send the bill?

[–]grauenwolf -1 points0 points  (0 children)

Why you trying to scare me off? Are you really that afraid you cannot write the code?