class ClassB
{
    int option;
public:
    ClassB(void){} //without the default constructor, the example does not compile.
    ClassB(int option)
    {
        this->option = option;
    }
};
class ClassA
{
    ClassB objB; //initialize objB using default constructor. When does this actually occur?
public:
    ClassA(int option)
    {
        objB = ClassB(option); //initialize objB again using another constructor.
    }
};
int main(void)
{
    ClassA objA (2);
    return 0;
}
I'm new to c++ (coming from c#), and i'm a bit confused about how class variables are initialized. In the above example, ClassA declares a class object of type ClassB, stored by value. In order to do this, ClassB must have a default constructor, which implies that ClassA first creates a ClassB using the default constructor. But ClassA never uses this default objB because it's immediately overwritten in ClassA's constructor.
So my question: Is objB actually initialized twice?
If so, isn't that an unnecessary step? Would it be faster to declare objB as a pointer?
If not, why does ClassB need to have a default constructor?
 
    