in reply to Re: Re: Rethinking Your Program's If-Thens
in thread Rethinking Your Program's If-Thens

It would be the wrong way if it were all one class. In this case, the if is in the factory class. In the example, there is one class who's behaviors change based on the values in the class. What I have above is a factory class deciding what subclass to return based on the value passed in. Each class, then, behaves differently.
  • Comment on Re: Re: Re: Rethinking Your Program's If-Thens