What will happen if a user defined constructor omits initialization for data members?

Viewed 243

Suppose:

class Foo
{
public: 
    Foo();
    Foo(typeA a);
private:
    typeB b;
    typeC c;
};

Foo::Foo(typeA a)
{
    //do something with a, but nothing with b nor c.
}

int main()
{
    typeA a;
    Foo foo(a);
    return 0;
}

What will happen here? Are foo.b and foo.c default initialized? Is it a good practice to define a constructor this way?

3 Answers
Related