In State design pattern Why the main class need to know about all the states at the beginning?

前端 未结 0 1908
小蘑菇
小蘑菇 2020-12-03 07:02

I was reading a book about design patterns and the code was written as : example:

 class Fan{
   private IState State1;
   private IState State2;
  .
  .
  .
         


        
相关标签:
回答
  • 消灭零回复
提交回复
热议问题