class A {
public:
    A(int v) {
        _val = v;
    }
private:
    int _val;
};
class B {
public:
    B(int v) {
        a = A(v); // i think this is the key point
    }
private:
    A a;
};
int main() {
    B b(10);
    return 0;
}
コンパイラは言う:
test.cpp: In constructor ‘B::B(int)’:
test.cpp:15: error: no matching function for call to ‘A::A()’
test.cpp:5: note: candidates are: A::A(int)
test.cpp:3: note:                 A::A(const A&)
私はJavaを学びましたが、C++でこれに対処する方法がわかりません。数日検索すると、plzはC ++でこれを実行できると教えてくれますか?