Consider class A and B. Class A is befriended by class B. Class B has a private constructor. Can class A create class B instances, or is a private constructor an indication to the compiler that the class cannot be instantiated, even by a friend class?
Here's some sample code:
class B;
class A {
void myFunction() {
B newBobject;
}
};
class B {
private:
B() {}
public:
int someData;
friend class A;
};
Also, note I'm using C++03. If it's not valid in C++03, is it allowed in C++11?
As a side question, how is the Singleton method related? Does it deal specifically with instantiating one and only one instance of an object, or is it something else?