I am spitting through some old C++ code. In it, I declare a local variable like this:
Pen blackPen(Color(255, 0, 0, 0));
This seems to call the constructor.
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
Pen blackPen;
But now I don't know how to initialize it:
blackPen = Pen(Color(255, 0, 0, 0));
seems the most reasonable, but I get an error:
"Gdiplus::Pen::Pen(const Gdiplus::Pen &)" (declared at line 452 of "c:\Program Files (x86)\Windows Kits\8.1\Include\um\gdipluspen.h") is inaccessible
The following snippet shows this behavior:
#include <windows.h>
#include <gdiplus.h>
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;
}