title: Can constructor call another class's constructor in c++?
body: <pre><code>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;
  }
  </code></pre>
  
  <p>compiler says:</p>
  
  <pre><code>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&amp;)
  </code></pre>
  
  <p>I've learned Java, and I don't know how to deal with this in C++.
  Searching for a couple days, plz tell me can C++ do this?</p>