title: Initialising enum via constructors
body: <p>I have an enum as a public memebr of a class as follows"</p>
  
  <pre><code>class myClass
  {
      public:
          enum myEnum
          {
              myEnum1,
              myEnum2
          };
  };
  </code></pre>
  
  <p>I also declare a constructors, a public parameterized one as follows:</p>
  
  <pre><code>myClass(myEnum);
  </code></pre>
  
  <p>I define the same outside the classs definition as follows:</p>
  
  <pre><code>myClass :: myClass(myEnum E)
  {
  }
  </code></pre>
  
  <p><strong>How do I initialise myEnum with default arguments?</strong></p>
  
  <p>I tried:</p>
  
  <p>i) </p>
  
  <pre><code>myClass :: myClass(myEnum E = 0); //to int error
  </code></pre>
  
  <p>ii)</p>
  
  <pre><code>myClass :: myClass(myEnum E = {0}); //some error
  </code></pre>
  
  <p>iii)</p>
  
  <pre><code>myClass :: myClass(myEnum E = {0, 1}); //some error
  </code></pre>
  
  <p><strong>One thing I still don't seem to understand.</strong></p>
  
  <p>How do I pass enum values to the constructor. I still get an error. And, I need to do it this way:</p>
  
  <pre><code>derived(arg1, arg2, arg3, enumHere, arg4, arg5); //call
  </code></pre>
  
  <p>Function definition:</p>
  
  <pre><code>derived(int a, int b, int c, enumHere, int 4, int 5) : base(a, b);
  </code></pre>
  
  <p><strong>Where am I supposed to initialise the enum, as one of the answers belowe do it?</strong></p>