Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

5
  • 1
    Duplicate: stackoverflow.com/questions/185844/… (taken from the list on the right, seriously!)
    – Alec Teal
    Commented Jan 10, 2014 at 10:19
  • You could remove the data members and make them local static variables inside getConnection(). Commented Jan 10, 2014 at 10:20
  • @AlecTeal it is a duplicate? not really because the answer in your mentioned thread is not applicable since initializing a private static member outside of the class is not possible!
    – tuxmania
    Commented Jan 10, 2014 at 10:22
  • It really is a duplicate.
    – Alec Teal
    Commented Jan 10, 2014 at 10:41
  • 1
    to clarify: both are about how to define a private static variable, yes. The problem is a bit different in both cases, but looking at the solution should give the correct idea in any case (here, that the type was missing, there, that the definition was in the header file but should have been in the cpp file). So technically, the question is actually not a real duplicate (it is not the exact same question), but close enough.
    – codeling
    Commented Jan 10, 2014 at 11:08