Tech Off Post

Single Post Permalink

View Thread: Optional parameters are evil
  • User profile image
    Shining Arcanine

    Sven Groot said:

    Why is this symptomatic of optional parameters? I can run into exactly the same problem without them:

     

    enum SomeEnum{One, Two};
    class SomeClass
    {
      private SomeEnum someEnum;
    
      private DoWork(SomeEnum someEnum)
      {
        someEnum = someEnum;
      }
    }

     

    No optional parameters, same problem.

    enum SomeEnum{One, Two}; class SomeClass { private SomeEnum someEnum; private DoWork(SomeEnum someEnum) { this->someEnum = someEnum; } }

     

    That should fix it. Although I have never tried it, ::someEnum or SomeClass::someEnum might also work.