title: C++ initialization as function
body: <p>I am spitting through some old C++ code.
  In it, I declare a local variable like this:</p>
  
  <pre><code>Pen blackPen(Color(255, 0, 0, 0));
  </code></pre>
  
  <p>This seems to call the constructor.</p>
  
  <p>I am trying to make this a global variable, which I want to initialize in a function. However, I am not able to split the variable from it's initialization in this way. Of course, I can define a global variable</p>
  
  <pre><code>Pen blackPen;
  </code></pre>
  
  <p>But now I don't know how to initialize it:</p>
  
  <pre><code>blackPen = Pen(Color(255, 0, 0, 0));
  </code></pre>
  
  <p>seems the most reasonable, but I get an error:</p>
  
  <blockquote>
    <p>"Gdiplus::Pen::Pen(const Gdiplus::Pen &amp;)" (declared at line 452 of "c:\Program Files (x86)\Windows Kits\8.1\Include\um\gdipluspen.h") is inaccessible</p>
  </blockquote>
  
  <p>The following snippet shows this behavior:</p>
  
  <pre><code>#include &lt;windows.h&gt;
  #include &lt;gdiplus.h&gt;
  using namespace Gdiplus;
  
  Pen redPen;
  
  int main(int argc, char *argv[])
  {
      Pen greenPen(Color(255, 0, 0, 0)); // this initialization works
      redPen = Pen(Color(255, 0, 0, 0)); // but this doesn't...
      return 0;
  }
  </code></pre>