Q:

c++ Using overloaded constructor on object composition

may I know how do i use a overloaded constructor for object composition in another class, here's an example code:
class A {
    int a;

    A( int inputA ) { a = inputA; }
};

class B {
    A objectA;

    B( A inputObjectA ) { objectA = inputObjectA; }
};

The error with the compiler was there is no default constructor A::A() ? 
Is there any way to edit the code in the parameter of B's constructor to accept the overloaded constructor in A?

A:

If a child has no default constructor, parent's constructor should pass parameters.
class A {
public:
    int a;
    A( int inputA ) { a = inputA; }
};

class B {
    A objectA;
public:
    B( A inputObjectA ): objectA(inputObjectA.a) { }
};

http://ideone.com/QavhfY
In your case it would be appropriate to use a copy constructor for A, instead of making its member public:
class A {
    int a;
public:
    A( int inputA ) { a = inputA; }
};

class B {
    A objectA;
public:
    B(A inputObjectA ): objectA(inputObjectA) { }
};

http://ideone.com/wX1clr

